--- a/graph.php
+++ b/graph.php
@@ -6,36 +6,46 @@
$format = $_REQUEST['format'];
}
-function add_node($id, $label) {
+function add_node($id, $label, $parent="") {
global $format;
if ($format == "html") {
- echo "nodes[\"$id\"] = graph.newNode({label: \"$label\"});" . PHP_EOL;
+ // echo "nodes[\"$id\"] = graph.newNode({label: \"$label\"});" . PHP_EOL;
}
if ($format == "dot" && $label != "") {
- echo "$id [label=\"$label\"];". PHP_EOL;
+ echo "\"$id\" [label=\"$label\", shape=plaintext];". PHP_EOL;
}
+ if ($format == "gexf") {
+ echo "":">")
+ .""
+ ."". PHP_EOL;
+ }
}
function add_edge($from, $to, $color) {
global $format;
if ($format == "html") {
- echo "graph.newEdge(nodes[\"$from\"], nodes['$to'], {color: '$color'});" . PHP_EOL;
+ // echo "graph.newEdge(nodes[\"$from\"], nodes['$to'], {color: '$color'});" . PHP_EOL;
}
if ($format == "dot") {
- echo "$from -> $to ".($color != ""? "[color=$color]":"").";". PHP_EOL;
+ echo "\"$from\" -> \"$to\" ".($color != ""? "[color=$color]":"").";". PHP_EOL;
}
+ if ($format == "gexf") {
+ echo "". PHP_EOL;
+ }
+}
+if ($format == "gexf") {
+ //header('Content-Type: text/xml');
+ header('Content-Type: application/gexf+xml');
+echo '
+
+
+ Gexf.net
+ A hello world! file
+
+
+ '. PHP_EOL;
}
-if ($format == "html") {
- ?>
-
-
-
-
+
+
+
+
+
+
+
+'. PHP_EOL;
+}
//include_footer();
?>