2017 © Pedro Peláez
 

library graphml

GraphML is an XML-based file format for graphs

image

graphp/graphml

GraphML is an XML-based file format for graphs

  • Monday, June 8, 2015
  • by clue
  • Repository
  • 1 Watchers
  • 8 Stars
  • 2,280 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 4 Open issues
  • 2 Versions
  • 6 % Grown

The README.md

graphp/graphml

CI status, (*1)

GraphML is an XML-based file format for graphs, (*2)

Note: This project is in early beta stage! Feel free to report any issues you encounter., (*3)

Table of contents, (*4)

Usage

Exporter

getOutput()

The getOutput(Graph $graph): string method can be used to export the given graph instance., (*5)

$graph = new Fhaculty\Graph\Graph();

$a = $graph->createVertex('a');
$b = $graph->createVertex('b');
$a->createEdgeTo($b);

$exporter = new Graphp\GraphML\Exporter();
$data = $exporter->getOutput($graph);

file_put_contents('example.graphml', $data);

This method only supports exporting the basic graph structure, with all vertices and directed and undirected edges., (*6)

Note that none of the attributes attached to any objects nor any of the "advanced concepts" of GraphML (Nested Graphs, Hyperedges and Ports) are currently implemented. We welcome PRs!, (*7)

Loader

loadContents()

The loadContents(string $contents): Graph method can be used to load a graph instance from the given GraphML contents., (*8)

$data = file_get_contents('example.graphml');

$loader = new Graphp\GraphML\Loader();
$graph = $loader->loadContents($data);

foreach ($graph->getVertices() as $vertex) {
    foreach ($vertex->getVerticesEdgeTo() as other) {
        echo $vertex->getId() . ' connected with ' . $other->getId() . PHP_EOL;
    }
}

This method supports loading the graph, all vertices and directed and undirected edges among with any attributes attached from the GraphML source., (*9)

Note that neither of the "advanced concepts" of GraphML (Nested Graphs, Hyperedges and Ports) are currently implemented. We welcome PRs!, (*10)

Install

The recommended way to install this library is through composer. New to composer?, (*11)

{
    "require": {
        "graphp/graphml": "~0.1.0"
    }
}

This project aims to run on any platform and thus does not require any PHP extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. It's highly recommended to use PHP 7+ for this project., (*12)

Tests

To run the test suite, you first need to clone this repo and then install all dependencies through Composer:, (*13)

$ composer install

To run the test suite, go to the project root and run:, (*14)

$ php vendor/bin/phpunit

License

Released under the terms of the permissive MIT license., (*15)

The Versions

08/06 2015

dev-master

9999999-dev https://github.com/graphp/graphml

GraphML is an XML-based file format for graphs

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christian Lück

graphml graph xml

08/06 2015

v0.1.0

0.1.0.0 https://github.com/graphp/graphml

GraphML is an XML-based file format for graphs

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christian Lück

graphml graph xml