Skip to content

Evref-BL/PharoGEXF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PharoGEXF

Moose 10 Coverage Status

Manipulate GEXF file format with Pharo.

Installation

Metacello new
  githubUser: 'badetitou' project: 'PharoGEXF' commitish: 'main' path: 'src';
  baseline: 'GEXF';
  load

Usage

Basic commands

  1. Create a gexf element
    gexf := GEXF new.
  2. Set metadata
    gexf metadata creator: 'Gephi.org'.
    gexf metadata description: 'A Web network'.
  3. Add nodes
    graph := gexf graph.
    node1 := graph createNodeWithId: '0'.
    node1 label: 'Hello'.
    node2 := graph createNodeWithId: '2'.
    node2 label: 'World'.
  4. Connect nodes
    node1 connectTo: node2.
  5. Export file
    String streamContents: [:stream |
        (GEXFWriter on: stream)
    	    prettyPrinting;
     	    export: gexf ]

Full example to show dependencies of classes from Moose

classes := ((model allWithSubTypesOf: FamixJavaType)  select: [ :d | d isStub not and: [ d isAnonymousClass not ]  ]).

gexf := GEXF new.
gexf metadata creator: 'Gephi.org'.
gexf metadata description: 'my project'.

graph := gexf graph.

dicClassNode := classes collect: [ :class | 
	| node |
	node := graph createNode.
	node label: class mooseName.
	class -> node
	 ] as: Dictionary.

dicClassNode keysAndValuesDo: [ :class :node |
	(class query outgoing dependencies targetsAtScope: FamixTType) do: [ :dep |
		dicClassNode at: dep ifPresent: [ :aDepNode | node connectTo: aDepNode ]
		 ] 
	 ].




'd:/seditRHDep.gexf' asFileReference writeStreamDo:  [:stream |
    (GEXFWriter on: stream)
	    prettyPrinting;
 	    export: gexf ]

About

Manipulate GEXF file format with Pharo

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published