Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/evref-bl/pharogexf
Manipulate GEXF file format with Pharo
https://github.com/evref-bl/pharogexf
gexf pharo
Last synced: 5 days ago
JSON representation
Manipulate GEXF file format with Pharo
- Host: GitHub
- URL: https://github.com/evref-bl/pharogexf
- Owner: Evref-BL
- License: mit
- Created: 2022-12-21T10:22:43.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-07T15:45:04.000Z (over 1 year ago)
- Last Synced: 2024-05-18T19:29:48.543Z (7 months ago)
- Topics: gexf, pharo
- Language: Smalltalk
- Homepage:
- Size: 52.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PharoGEXF
[![Moose 10](https://github.com/badetitou/PharoGEXF/actions/workflows/test.yml/badge.svg)](https://github.com/badetitou/PharoGEXF/actions/workflows/test.yml)
[![Coverage Status](https://coveralls.io/repos/github/badetitou/PharoGEXF/badge.svg?branch=main)](https://coveralls.io/github/badetitou/PharoGEXF?branch=main)Manipulate [GEXF file format](https://gexf.net) with Pharo.
## Installation
```st
Metacello new
githubUser: 'badetitou' project: 'PharoGEXF' commitish: 'main' path: 'src';
baseline: 'GEXF';
load
```## Usage
### Basic commands
1. Create a gexf element
```st
gexf := GEXF new.
```
2. Set metadata
```st
gexf metadata creator: 'Gephi.org'.
gexf metadata description: 'A Web network'.
```
3. Add nodes
```st
graph := gexf graph.
node1 := graph createNodeWithId: '0'.
node1 label: 'Hello'.
node2 := graph createNodeWithId: '2'.
node2 label: 'World'.
```
4. Connect nodes
```st
node1 connectTo: node2.
```
5. Export file
```st
String streamContents: [:stream |
(GEXFWriter on: stream)
prettyPrinting;
export: gexf ]
```### Full example to show dependencies of classes from Moose
```st
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 ]
```