Data and Tools‎ > ‎

Labeled Graph Format

A Labeled Graph file describes a heterogeneous graph, where the nodes and/or edges can have different types. It is a space delimited text file, as illustrated in the sample below.

t #
v 0 0
v 1 1
v 2 0
v 3 1
e 0 1 0
e 1 2 0
e 2 3 1

The first line starting with "t #" is a header, indicating that the file contains a graph.

Each of the next few lines starting with "v" represents a node: v <NodeID> <NodeType>. Both <NodeID> and <NodeType> are integers, which can be uniquely mapped to a node and type of the node, respectively. Furthermore, these lines must strictly contain <NodeID> in a sorted and consecutive manner starting from 0, i.e., 0, 1, 2, ...

Each of the subsequent lines starting with "e" represents an edge: e <NodeID-1> <NodeID-2> <EdgeType>. The edge can be either undirected, or directed from <NodeID-1> to <NodeID-2>, depending on the scenario. <EdgeType> is also an integer, uniquely mapping to the type of the edge.