Uses 970K of libraries. Click here for Pure Java version (63L/1K/2K).
1 | !7 |
2 | |
3 | lib 1007168 // graphstream core 1.3 |
4 | |
5 | import org.graphstream.graph.*; |
6 | import org.graphstream.graph.implementations.*; |
7 | import org.graphstream.ui.spriteManager.*; // SpriteManager |
8 | |
9 | p { |
10 | Graph graph = new SingleGraph("Graph with sprites"); |
11 | |
12 | graph.addNode("A"); |
13 | graph.addNode("B"); |
14 | graph.addNode("C"); |
15 | graph.addEdge("AB", "A", "B"); |
16 | graph.addEdge("BC", "B", "C"); |
17 | graph.addEdge("CA", "C", "A"); |
18 | |
19 | SpriteManager sm = new SpriteManager(graph); |
20 | /* This shows another node labelled "(0,0)" floating around. |
21 | Sprite C = sm.addSprite("C"); |
22 | C.setPosition(0, 0, 0); |
23 | C.setAttribute("ui.label", "(0,0)"); |
24 | */ |
25 | Sprite s = sm.addSprite("Label for A"); |
26 | s.setPosition(0, 0, 0); |
27 | s.setAttribute("ui.label", "Node A"); |
28 | s.attachToNode("A"); |
29 | |
30 | s = sm.addSprite("Label for Edge AB"); |
31 | s.setAttribute("ui.label", "Edge AB"); |
32 | s.setPosition(0.5); |
33 | s.attachToEdge("AB"); |
34 | |
35 | graph.display(); |
36 | } |
Began life as a copy of #1007167
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007169 |
Snippet name: | Test GraphStream with sprites (labels) [dev.] |
Eternal ID of this version: | #1007169/6 |
Text MD5: | ca4f39198b24624f8e9210af88874ac1 |
Transpilation MD5: | 68d675585f88a7434e139f469e933f9a |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-10 14:50:42 |
Source code size: | 928 bytes / 36 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 459 / 517 |
Version history: | 5 change(s) |
Referenced in: | [show references] |