Drawing the graph
You can interact in all sorts of ways with the
AGraph
container object that you cre-
ated in the previous section, but many of those ways to interact are abstract and
not very satisfying if you’re a visually oriented person. Sometimes it’s just nice to
see what an object contains by looking at it. The following code displays the graph
contained in
AGraph
:
nx.draw(AGraph, with_labels=True)
The
draw()
function provides various arguments that you can use to dress up the
display, such as modifying the node color using the
node_color
argument and the
edge color using the
edge_color
argument. Figure 8-4 shows the graph contained
in
AGraph
.
FIGURE 8-4:
Seeing what a
graph contains
makes it easier to
understand.
164
PART 3
Do'stlaringiz bilan baham: |