Open a graph file using the SPMF Graph Viewer (SPMF documentation)

This example explains how to open a graph file using the SPMF Graph Viewer .

The SPMF graph viewer is a simple tool to visualize the content of a file containing graphs.

The Graph Viewer is designed mainly to:

  1. read input files that contain one or more graphs that follow the input format of the gSpan, cgSpan and TKG algorithms, or similar algorithms
  2. read output files that contain subgraphs found by the gSpan, cgSpan and TKG algorithms, or similar algorithms

Below, I will explain these two cases.

Example 1: Visualizing a graph database file

How to run this example?

graph viewer open

What will be displayed?

After running the example, the content of the file will be displayed by the Graph Viewer. The picture below show the results and explain the different functions of the Graph viewer. Then, after that, I will explain the file format.

graph viewer database graph

What is the input?

The input file format is defined as follows. It is a text file which contains one or more graphs.  A graph is defined by a few lines of text that follow the following format:

For the above example, the input file is defined as follows:

t # 0
v 0 10
v 1 11
v 2 10
v 3 11
e 0 1 20
e 1 2 23
e 1 3 22

t # 1
v 4 10
v 5 11
e 4 5 20

t # 2
v 6 10
v 7 10
v 8 11
v 9 11
e 6 7 21
e 7 8 23
e 7 9 20
e 8 9 22

The first graph is displayed in the example picture above by the Graph Viewer.

Example 2: Visualizing a file containing subgraphs discovered by a frequent subgraph mining algorithm

How to run this example?

graph viewer open

What will be displayed?

After running the example, the content of the file will be displayed by the Graph Viewer. The picture below show the results and explain the different functions of the Graph viewer. Then, after that, I will explain the file format.

graph viewer database graph

What is the input?

The input file format is defined as follows. It is a text file, listing subgraphs found by an algorithm. A frequent subgraph is defined by a few lines of text that follow the following format:

For the above example, the input file is defined as follows:

t # 0 * 3
v 0 10
v 1 11
e 0 1 20
x 0 1 2

t # 1 * 3
v 0 11
x 0 1 2

t # 2 * 3
v 0 10
x 0 1 2

The first graph is displayed in the example picture above by the Graph Viewer.

Other ways of launching the Graph Viewer

When running a subgraph mining algorithm like TKG in SPMF using the graphical user interface, it is possible to choose to open the output file produced by the algorithm using the GraphViewer using this option of the graphical user interface:

graph viewer save