Graph file format
Graphs are plain text, one item per line:
t 4 4
v 0 1 2
v 1 2 2
v 2 1 2
v 3 2 2
e 0 1
e 1 2
e 2 3
e 3 0
t N MThe number of vertices
Nand edgesM. Informative only: the reader ignores it.v ID LABEL [DEGREE]A vertex, its label and optionally its degree (ignored).
e U VAn undirected edge between vertices
UandV. Further fields, such as an edge label, are ignored.
This is the format of the SubgraphMatching benchmarks.
Details
Vertex IDs and labels are integers that fit in 64 bits. IDs need not be
0..N-1, contiguous or in order.Only lines whose first field is exactly
voreare read; blank and other lines are ignored. Fields are separated by spaces or tabs, and lines may end in\n,\r\nor\r.A repeated edge, in either direction, is kept once, and so is a repeated self-loop. A repeated
vline keeps the vertex’s first position and updates its label.A vertex that appears only in edges is added without a label. It matches no labelled pattern vertex.
Vertices are ordered with every
vline’s vertex first, in file order, then the vertices that appear only in edges, in order of first appearance. A vertex’s neighbours are in order of first appearance. This is the order NetworkX builds from the same file.A
voreline with a missing or non-integer field raisesValueErrorwith the line number.