Pajek (.net) Graph Format - Maple Programming Help

Home : Support : Online Help : Programming : Input and Output : File Formats : Formats/Pajek

Pajek (.net) Graph Format

Pajek file format

Description

 • Pajek is a text-based file format for storing a single directed or undirected graph.
 • The GraphTheory[ImportGraph] and GraphTheory[ExportGraph] commands can read from and write to this format.
 • The general-purpose commands Import and Export also support this format.

Examples

Import a Pajek file encoding the Petersen graph.

 > $\mathrm{Petersen}≔\mathrm{Import}\left("example/petersen.net",\mathrm{base}=\mathrm{datadir}\right)$
 ${\mathrm{Petersen}}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 10 vertices and 15 edge\left(s\right)}}$ (1)
 > $\mathrm{GraphTheory}:-\mathrm{DrawGraph}\left(\mathrm{Petersen}\right)$

Import a Pajek file encoding the constellation Draco.

 > $\mathrm{Draco}≔\mathrm{Import}\left("example/draco.net",\mathrm{base}=\mathrm{datadir}\right)$
 ${\mathrm{Draco}}{≔}{\mathrm{Graph 2: an undirected unweighted graph with 14 vertices and 14 edge\left(s\right)}}$ (2)
 > $\mathrm{GraphTheory}:-\mathrm{DrawGraph}\left(\mathrm{Draco}\right)$

Export the Levi graph to a Pajek file in the home directory of the current user.

 > $\mathrm{LG}≔\mathrm{GraphTheory}:-\mathrm{SpecialGraphs}:-\mathrm{LeviGraph}\left(\right)$
 ${\mathrm{LG}}{≔}{\mathrm{Graph 3: an undirected unweighted graph with 30 vertices and 45 edge\left(s\right)}}$ (3)
 > $\mathrm{Export}\left("levi.net",\mathrm{LG},\mathrm{base}=\mathrm{homedir}\right)$
 ${1126}$ (4)