La bibliotheque GraphStream
Bonjour,
J'ai bien utilisée la documentation de GraphStream et j'ai crée mon graphe.J'ai besoin de sauvegarde l’exécution de ce graphe sous forme d'un fichier.DGS , comment je peux faire ça svp!!
J'ai bien utilisée la documentation de GraphStream et j'ai crée mon graphe.J'ai besoin de sauvegarde l’exécution de ce graphe sous forme d'un fichier.DGS , comment je peux faire ça svp!!
1 réponse
-
ModérateurBonjour,
La manipulation des fichiers se fait via les classes org.graphstream.stream.file.*
Dans ton cas avec FileSinkDGS.writeAll(Graph graph, String fileName)-
-
Modérateur@DjahidaBenahmedUn exemple :
import org.graphstream.graph.implementations.SingleGraph; import org.graphstream.stream.file.FileSinkDGS; public class TestDGS { public static void main(String[] args) throws Exception { SingleGraph graph = new SingleGraph("graph", false, true); graph.addEdge("x", "a", "b"); new FileSinkDGS().writeAll(graph, "C:/graph.dgs"); } }
Le fichier C:/graph.dgs peut se lire avec un éditeur de texte, il contient :DGS004
null 0 0
an "a"
an "b"
ae "x" "a" "b" -
-