FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
plotdevice-libs/graph/examples/graph-1.pv at master · plotdevice/plotdevice-libs · GitHub
plotdevice
plotdevice-libs
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
plotdevice-libs
/
graph
/
examples
/
graph-1.pv
Copy path
More file actions
More file actions
Latest commit
History
History
History
33 lines (26 loc) · 791 Bytes
Breadcrumbs
plotdevice-libs
/
graph
/
examples
/
graph-1.pv
Copy path
File metadata and controls
33 lines (26 loc) · 791 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import graph
size(500, 500)
g = graph.create()
# Create some relations.
g.add_edge("roof" , "house")
g.add_edge("garden" , "house")
g.add_edge("room" , "house")
g.add_edge("kitchen" , "room")
g.add_edge("bedroom" , "room")
g.add_edge("bathroom" , "room")
g.add_edge("living room" , "room")
g.add_edge("sofa" , "living room")
g.add_edge("table" , "living room")
# Calculate a good layout.
g.solve()
# Apply default rules for node colors and size,
# for example, important nodes become blue.
g.styles.apply()
# Draw the graph, indicating the direction of each relation
# and the two nodes that get the most traffic.
g.draw(
directed=True,
traffic=1
)
# You'll see that "house" is the key node,
# and that "room" gets the most traffic.
Back
|
FazBrowse Home
|
New Git URL