loadGraph() — graph2md Function Reference
Architecture documentation for the loadGraph() function in main.go from the graph2md codebase.
Entity Profile
Dependency Diagram
graph TD 38f2edb8_56a8_afe2_8475_0a20030eb7b1["loadGraph()"] 19d7285e_2dbf_69a0_6ada_b2031521fd4e["main.go"] 38f2edb8_56a8_afe2_8475_0a20030eb7b1 -->|defined in| 19d7285e_2dbf_69a0_6ada_b2031521fd4e b8c81770_53e9_c49f_8a64_ee57b9b3bb27["main()"] b8c81770_53e9_c49f_8a64_ee57b9b3bb27 -->|calls| 38f2edb8_56a8_afe2_8475_0a20030eb7b1 style 38f2edb8_56a8_afe2_8475_0a20030eb7b1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
main.go lines 2060–2090
func loadGraph(path string) ([]Node, []Relationship, error) {
data, err := os.ReadFile(path)
if err != nil {
return nil, nil, err
}
log.Printf(" File size: %d bytes", len(data))
var resp APIResponse
if err := json.Unmarshal(data, &resp); err != nil {
log.Printf(" APIResponse unmarshal error: %v", err)
} else if resp.Result == nil {
log.Printf(" APIResponse parsed but Result is nil (status=%s)", resp.Status)
} else {
g := resp.Result.Graph
log.Printf(" APIResponse parsed: %d nodes, %d rels", len(g.Nodes), len(g.Relationships))
return g.Nodes, g.Relationships, nil
}
var result GraphResult
if err := json.Unmarshal(data, &result); err == nil && len(result.Graph.Nodes) > 0 {
return result.Graph.Nodes, result.Graph.Relationships, nil
}
var graph Graph
if err := json.Unmarshal(data, &graph); err == nil && len(graph.Nodes) > 0 {
return graph.Nodes, graph.Relationships, nil
}
return nil, nil, fmt.Errorf("unrecognized graph format")
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does loadGraph() do?
loadGraph() is a function in the graph2md codebase, defined in main.go.
Where is loadGraph() defined?
loadGraph() is defined in main.go at line 2060.
What calls loadGraph()?
loadGraph() is called by 1 function(s): main.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free