La bibliotheque GraphStream

Fermé
DjahidaBenahmed Messages postés 9 Date d'inscription lundi 7 janvier 2019 Statut Membre Dernière intervention 3 avril 2019 - 29 janv. 2019 à 17:58
DjahidaBenahmed Messages postés 9 Date d'inscription lundi 7 janvier 2019 Statut Membre Dernière intervention 3 avril 2019 - 30 janv. 2019 à 14:27
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!!
A voir également:
  • La bibliotheque GraphStream
  • GraphStream - Télécharger - Langages

1 réponse

KX Messages postés 16734 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 24 avril 2024 3 015
29 janv. 2019 à 18:27
Bonjour,

La manipulation des fichiers se fait via les classes org.graphstream.stream.file.*
Dans ton cas avec FileSinkDGS.writeAll(Graph graph, String fileName)
1
DjahidaBenahmed Messages postés 9 Date d'inscription lundi 7 janvier 2019 Statut Membre Dernière intervention 3 avril 2019
29 janv. 2019 à 19:14
Ah d'accord Merci, tu peux me donne un exemple svp et aussi Est ce que j'ai besoin d'un logiciel pour lire cette fichier.DGS??
0
KX Messages postés 16734 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 24 avril 2024 3 015 > DjahidaBenahmed Messages postés 9 Date d'inscription lundi 7 janvier 2019 Statut Membre Dernière intervention 3 avril 2019
29 janv. 2019 à 19:56
Un 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"
0
DjahidaBenahmed Messages postés 9 Date d'inscription lundi 7 janvier 2019 Statut Membre Dernière intervention 3 avril 2019
30 janv. 2019 à 14:27
Merci énormément
0