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

  • SEARCH
  • Home
  • 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 9022927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:38:12+00:00 2026-06-16T05:38:12+00:00

for my thesis I need to draw some probabilistic control flow graphs. i.e. control

  • 0

for my thesis I need to draw some probabilistic control flow graphs. i.e. control flow graphs with probabilities depicted on the edges.

I found graph-tool which seems quite useful, since it can use deep-copies of existing graphs and my graphs are quite similar.

So my question is, if there is a possibility to draw edge properties (or some strings) on/next to the edges? If it’s not possible or highly complicated, is there a tool which is better to use in this case?

Edit:
I need directed edges that can even create loops between 2 nodes and have different values. Is there a possibility for this too? So I can see both values? By now I can see the directed graph with a 2-directional edge, but there’s only one value on it.

So e.g. in networkx (in reference to Hooked) it would look like:

G = nx.MultiDiGraph()
G.add_edge(0,1)
G.add_edge(1,0)
labels = {(0,1):'foo', (1,0):'bar'}

So that both ‘foo’ and ‘bar’ are visible and you can see which direction they are connected to.

But as networkx renders it, I get 1 bidirectional edge with 1 of the labels.

  • 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-16T05:38:13+00:00Added an answer on June 16, 2026 at 5:38 am
    import networkx as nx   
    
    # Sample graph
    G = nx.Graph()
    G.add_edge(0,1)
    G.add_edge(1,2)
    G.add_edge(2,3)
    G.add_edge(1,3)
    
    labels = {(0,1):'foo', (2,3):'bar'}
    
    pos=nx.spring_layout(G)
    
    nx.draw(G, pos)
    nx.draw_networkx_edge_labels(G,pos,edge_labels=labels,font_size=30)
    
    import pylab as plt
    plt.show()
    

    enter image description here

    EDIT: If you need multidigraphs with edge labels, I don’t think you can do this completely within networkx. However you can do most of it in python and do the rendering and layout with another program:

    import networkx as nx
    
    G = nx.MultiDiGraph()
    G.add_edge(0,1, label='A')
    G.add_edge(1,0, label='B')
    G.add_edge(2,3, label='foo')
    G.add_edge(3,1, label='bar')   
    nx.write_dot(G, 'my_graph.dot')
    

    I use graphviz to turn this into an image. On my Unix machine I run this from the command-line

    dot my_graph.dot -T png > output.png
    

    Which gives the desired output you are looking for. Note that graphviz has many ways to customize the visual appearance. The above example simply produces:

    enter image description here

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

Sidebar

Related Questions

I need topic ideas related to AI on which I will base my thesis.
I need to produce a PDF document in which I need some "chapters" (along
Actually We are doing thesis work where we need to make 10 voip phones
I'm beginning to analyse datas for my thesis. I first need to count consecutive
i am writing my bachelor thesis and there is some C++ code attached to
I'm using CUP to create a parser that I need for my thesis. I
I'm working on some custom C++ static code analysis for my PHD thesis. As
I'm developing an application for my final thesis on computer science, and I need
I need to extract text-only content from my thesis document written in LaTeX for
For my diploma thesis I need to implement certain static C code analysis and

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.