Skip to content

linuxgnu/GEXF-library

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

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);

About

PHP class to help with building GEXF networks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%