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 8416581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:48:01+00:00 2026-06-10T01:48:01+00:00

I am using python + igraph 0.6 for the first time and have some

  • 0

I am using python + igraph 0.6 for the first time and have some basic questions.

First, I would like to make a random graph and then insert a clique into it somewhere.

from igraph import *
g = Graph.Erdos_Renyi(50,0.1)
h = Graph.Full(5)

How do I make a new graph g2 with h connected by two edges to the graph g?

Second, having done this I would like to find maximal cliques and show in a picture where they are. Call the combined graph g2.

mcliques = g2.maximal_cliques(4, 7)

How can I now plot the cliques we have just found either separately or in the graph g2?

  • 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-10T01:48:03+00:00Added an answer on June 10, 2026 at 1:48 am

    Answer to your first question:

    g2 = g + h
    g2.add_edges([(0, 50), (1, 51)])
    

    or even simpler:

    g2 = g + h + [(0, 50), (1, 51)]
    

    Here we make use of the fact that the + operator between two graphs creates a disjoint union of the two graphs, and since igraph always uses a consecutive vertex ID range, we can simply know that vertices 0-49 of g2 will span g and vertices 50-54 will span h.

    Regarding your second question, you did not specify what exactly you mean by plotting the cliques, but a possible solution is as follows:

    group_markers = [(clique, "gray") for clique in mcliques]
    plot(g2, mark_groups=group_markers)
    

    See the documentation of Graph.__plot__ for more information about the mark_groups parameter; basically it is either a dictionary mapping colors to groups of vertices (vertex ids), or a list yielding pairs of vertex ids and colors. The vertex groups are then enclosed by a shaded area with the given color as background.

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

Sidebar

Related Questions

I am using igraph (via python) for graph clustering. I have a tree (a
Using Python I would like to find the date object for last Wednesday. I
I'm using Python 2.7. Let's say I have a list like so: string_list =
Using python's optparse module I would like to add extra example lines below the
Using Python's Imaging Library I want to create a PNG file. I would like
Using python I have to retrieve value of time and date of an event
Using Python 2.7 Situation: I have some piece of Python code (that the user
Using Python, how does one parse/access files with Linux-specific features, like ~/.mozilla/firefox/*.default ? I've
(Using Python 3.2, though I doubt it matters.) I have class Data , class
I'm using Python v2.6 and I have a string which contains a number of

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.