Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7833115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:34:13+00:00 2026-06-02T12:34:13+00:00

I want to build a directed graph and subscribe edges. import os import scipy

  • 0

I want to build a directed graph and subscribe edges.

import os
import scipy as sc
import pylab
import networkx 
import matplotlib.pyplot as plt
from networkx import *
from numpy import *

G=networkx.DiGraph()
R=[('S0','S1'),('S1','S2'),('S1','S7'),('S2','S3'),('S2','S6'),('S3','S4'),('S3','S6'),('S4','S5'),('S5','S6'),('S6','S7'),('S7','S8'),('S7','S5'),('S8','Sk') ] 

G.add_edges_from([ (2,3,) ])
G.add_edges_from(R) 
networkx.draw_circular(G)

plt.show()
plt.savefig("path.png");

Now I have done this. I built a graph, but I cannot think up how to subscribe edges. For example I want to mark S0 and S1 edge like "565", etc. It will make it more visual and demostrative.
Thanks in advance!

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T12:34:14+00:00Added an answer on June 2, 2026 at 12:34 pm

    Instead of layouting and drawing in one single step (networkx.draw_circular(G)), you can layout and draw nodes, edges, node labels and edge labels separately. Here’s a small example:

    import networkx as nx
    import matplotlib.pyplot as plt
    
    G=nx.DiGraph()
    R=[('S0','S1'),('S1','S2'),('S1','S7'),('S0','S7')] 
    
    G.add_edges_from(R)
    
    # Calculate layout and get all positions
    pos = nx.circular_layout(G)
    
    # Draw everything
    nx.draw_networkx_nodes(G, pos)
    nx.draw_networkx_edges(G, pos)
    nx.draw_networkx_labels(G, pos)
    nx.draw_networkx_edge_labels(G, pos, 
        {
            ('S0', 'S1'): 'edge1',
            ('S1', 'S2'): 'edge2',
            ('S1', 'S7'): 'edge3',
            ('S0', 'S7'): 'edge4'
        }
    )
    
    plt.axis('off')
    plt.savefig("path.png");
    plt.show()
    

    For more information about what parameters can be passed to the different drawing functions, check the documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to build a python program that deletes all the photos from my
i want to build a timer class that inherits from System.Timers.Timer. as so Class
i want build a photography app with effects . e.g. old images with brown
I want build a sketch pad app on iPhone, I assume that this type
i want to build a screen for user to get his marks on competitions,
I want to build flash application that can detect the user eyes color and
I want to build a form_tag that will allow me to post a new
I want to build a basic Client-Server application, where my android smartphone can stream
I want to build a console-like output using JTextPane. Therefore I am using a
I want to build my own listView with selectedItem and Itemsource. I have started

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.