Skip to content
Novus Examples
graphml4.3 KB

Social Network Graph (GraphML)

A small synthetic social network in GraphML — 12 people in two communities with a few bridging ties, carrying node attributes (name, age, community) and weighted edges. Twinned with a GEXF file for testing graph importers and format converters.

Preview — first 50 linesgraphml
<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <key id="d_name" for="node" attr.name="name" attr.type="string"/>
  <key id="d_age" for="node" attr.name="age" attr.type="int"/>
  <key id="d_comm" for="node" attr.name="community" attr.type="string"/>
  <key id="d_weight" for="edge" attr.name="weight" attr.type="double"/>
  <graph id="social" edgedefault="undirected">
    <node id="n0">
      <data key="d_name">Ada</data>
      <data key="d_age">29</data>
      <data key="d_comm">A</data>
    </node>
    <node id="n1">
      <data key="d_name">Ben</data>
      <data key="d_age">34</data>
      <data key="d_comm">A</data>
    </node>
    <node id="n2">
      <data key="d_name">Chen</data>
      <data key="d_age">41</data>
      <data key="d_comm">A</data>
    </node>
    <node id="n3">
      <data key="d_name">Dara</data>
      <data key="d_age">26</data>
      <data key="d_comm">A</data>
    </node>
    <node id="n4">
      <data key="d_name">Ede</data>
      <data key="d_age">38</data>
      <data key="d_comm">A</data>
    </node>
    <node id="n5">
      <data key="d_name">Faye</data>
      <data key="d_age">31</data>
      <data key="d_comm">B</data>
    </node>
    <node id="n6">
      <data key="d_name">Gus</data>
      <data key="d_age">45</data>
      <data key="d_comm">B</data>
    </node>
    <node id="n7">
      <data key="d_name">Hana</data>
      <data key="d_age">27</data>
      <data key="d_comm">B</data>
    </node>
    <node id="n8">
135 lines total — download for the full file.

Specifications

Nodes
12
Edges
21
Directed
false
Attributes
name, age, community; edge weight

What is a .graphml file?

GraphML is an XML-based format for describing graphs — nodes, edges, and typed attributes (keys) on either. It supports directed and undirected graphs, and is widely read by network tools such as Gephi, NetworkX, and yEd. Being plain XML, it is human-readable and easy to transform.

How to use this file

Use an example GraphML file to test graph and network importers, layout tools, and converters between GraphML, GEXF, and adjacency formats, or to verify that node and edge attributes survive a round-trip.

How to use this file for testing

“Social Network Graph (GraphML)” is a deterministic Novus Examples fixture for Graph data, Conversion testing, Data import. Node/edge datasets in GraphML and GEXF (directed and undirected, with attributes and weights) — for testing network importers, layout tools, and graph converters.

Documented properties for this file: 12 nodes · 21 edges. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Data fixtures document their exact quirks — delimiters, encodings, null handling, schema, and row counts — in the spec table. Point your parser or importer at the file and assert it handles the documented edge cases; clean and deliberately-messy siblings make before/after diffs straightforward.

Code examples

import networkx as nx  # pip install networkx

G = nx.read_graphml("social-network.graphml")
print(G.number_of_nodes(), "nodes", G.number_of_edges(), "edges")

Generated by generation/data_graphs.py. Free for any use, no attribution required — license.