Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/digitalmethodsinitiative/GEXF-library
PHP class to help with building GEXF networks.
https://github.com/digitalmethodsinitiative/GEXF-library
Last synced: 3 months ago
JSON representation
PHP class to help with building GEXF networks.
- Host: GitHub
- URL: https://github.com/digitalmethodsinitiative/GEXF-library
- Owner: digitalmethodsinitiative
- Created: 2013-04-17T13:42:43.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-01-08T14:58:36.000Z (almost 11 years ago)
- Last Synced: 2024-07-27T04:37:16.731Z (4 months ago)
- Language: PHP
- Size: 155 KB
- Stars: 8
- Watchers: 6
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
GEXF-library
============PHP class to help with building GEXF networks.
Example
=======// create new graph
$gexf = new Gexf();
$gexf->setTitle("Hashtag - user " . $filename);
$gexf->setEdgeType(GEXF_EDGE_UNDIRECTED);
$gexf->setCreator("tools.digitalmethods.net");
// fill bi-partite graph
foreach ($userHashtags as $user => $hashtags) {
foreach ($hashtags as $hashtag => $frequency) {
// make node 1
$node1 = new GexfNode($user);
$node1->addNodeAttribute("type", 'user', $type = "string");
$gexf->addNode($node1);
// make node 2
$node2 = new GexfNode($hashtag);
$node2->addNodeAttribute("type", 'hashtag', $type = "string");
$gexf->addNode($node2);
// create edge
$edge_id = $gexf->addEdge($node1, $node2, $frequency);
}
}
// render the file
$gexf->render();// write out the file
file_put_contents('file.gexf', $gexf->gexfFile);