Skip to content

Commit 0ec9af4

Browse files
committed
Use LightGraphs instead of Graphs in README.md
This readme still used mostly Graphs.jl instead of LightGraphs.jl. As the former package is deprecated and GraphPlots.jl does not work with it anymore, every occurrence of Graphs has changed to LightGraphs. Some functions functions such as num_vertices or out_degree had to be changed for that.
1 parent 819aff8 commit 0ec9af4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ gplot(g)
3333

3434
## Add node label
3535
```julia
36-
using Graphs
37-
nodelabel = [1:num_vertices(g)]
36+
using LightGraphs
37+
nodelabel = [1:nv(g)]
3838
gplot(g, nodelabel=nodelabel)
3939

4040
```
@@ -47,7 +47,7 @@ gplot(g, nodelabel=nodelabel, nodelabeldist=1.5, nodelabelangleoffset=π/4)
4747
## Control the node size
4848
```julia
4949
# nodes size proportional to their degree
50-
nodesize = [Graphs.out_degree(v, g) for v in Graphs.vertices(g)]
50+
nodesize = [LightGraphs.out_degree(g, v) for v in LightGraphs.vertices(g)]
5151
gplot(g, nodesize=nodesize)
5252
```
5353

@@ -57,7 +57,7 @@ Feed the keyword argument `nodefillc` a color array, ensure each node has a colo
5757
using Colors
5858

5959
# Generate n maximally distinguishable colors in LCHab space.
60-
nodefillc = distinguishable_colors(num_vertices(g), colorant"blue")
60+
nodefillc = distinguishable_colors(nv(g), colorant"blue")
6161
gplot(g, nodefillc=nodefillc, nodelabel=nodelabel, nodelabeldist=1.8, nodelabelangleoffset=π/4)
6262
```
6363

@@ -76,13 +76,13 @@ gplot(g, nodelabelsize=nodelabelsize, nodesize=nodesize, nodelabel=nodelabel)
7676

7777
## Draw edge labels
7878
```julia
79-
edgelabel = [1:Graphs.num_edges(g)]
79+
edgelabel = [1:LightGraphs.ne(g)]
8080
gplot(g, edgelabel=edgelabel, nodelabel=nodelabel)
8181
```
8282

8383
## Adjust edge labels
8484
```julia
85-
edgelabel = [1:Graphs.num_edges(g)]
85+
edgelabel = [1:LightGraphs.ne(g)]
8686
gplot(g, edgelabel=edgelabel, nodelabel=nodelabel, edgelabeldistx=0.5, edgelabeldisty=0.5)
8787
```
8888

@@ -122,7 +122,7 @@ gplot(g, layout=spectral_layout)
122122
```julia
123123
nlist = Array(Vector{Int}, 2) # two shells
124124
nlist[1] = [1:5] # first shell
125-
nlist[2] = [6:num_vertices(g)] # second shell
125+
nlist[2] = [6:nv(g)] # second shell
126126
locs_x, locs_y = shell_layout(g, nlist)
127127
gplot(g, locs_x, locs_y, nodelabel=nodelabel)
128128
```

0 commit comments

Comments
 (0)