Knowledge Map

The Knowledge Map operation takes an instance of kgx.graph.base_graph.BaseGraph and generates Translator API (TRAPI) compatible knowledge map for the entire graph.

This operation generates graph summary as a YAML in a format that is compatible with Knowledge Graph Exchange Registry.

The main entry point is the kgx.graph_operations.knowledge_map.generate_knowledge_map method.

Note: To generate a summary statistics YAML that is compatible with Knowledge Graph Hub dashboard, refer to Summarize Graph operation.

kgx.graph_operations.knowledge_map

kgx.graph_operations.knowledge_map.generate_knowledge_map(graph: kgx.graph.base_graph.BaseGraph, name: str, filename: str)None[source]

Generate a knowlege map that describes the composition of the graph and write to filename.

Parameters
  • graph (kgx.graph.base_graph.BaseGraph) – The graph

  • name (Optional[str]) – Name for the graph

  • filename (str) – The file to write the knowledge map to

kgx.graph_operations.knowledge_map.summarize_edges(graph: kgx.graph.base_graph.BaseGraph)List[Dict][source]

Summarize the edges in a graph.

Parameters

graph (kgx.graph.base_graph.BaseGraph) – The graph

Returns

The edge stats

Return type

List[Dict]

kgx.graph_operations.knowledge_map.summarize_graph(graph: kgx.graph.base_graph.BaseGraph, name: Optional[str] = None, **kwargs)Dict[source]

Generate a knowlege map that describes the composition of the graph.

Parameters
Returns

A knowledge map dictionary corresponding to the graph

Return type

Dict

kgx.graph_operations.knowledge_map.summarize_nodes(graph: kgx.graph.base_graph.BaseGraph)Dict[source]

Summarize the nodes in a graph.

Parameters

graph (kgx.graph.base_graph.BaseGraph) – The graph

Returns

The node stats

Return type

Dict