Questions tagged [bipartite]

A bipartite graph (aka bigraph) is a graph whose vertices can be divided into two disjoint sets such that vertices from one set only connect to the vertices from the other set and not each other. Applications where they arise include resource planning and coding theory.

339 questions
18
votes
7 answers

How to find if a graph is bipartite?

I have been trying to understand the bipartite graph. To my understanding it is a graph G which can be divided into two subgraphs U and V.So that intersection of U and V is a null set and union is graph G. I am trying to find if a graph is bipartite…
17
votes
2 answers

Where are the vertex names in an iGraph graph

My general problem is that I loose the vertex names / labels (not sure about the right word here) when generating a graph using iGraph. I have an edge list IC_edge_sub of a bipartite network, that looks like the following: new_individualID…
Henning Piezunka
  • 235
  • 1
  • 3
  • 9
15
votes
3 answers

Bipartite graph in NetworkX

B.add_nodes_from(a, bipartite=1) B.add_nodes_from(b, bipartite=0) nx.draw(B, with_labels = True) plt.savefig("graph.png") I am getting the following figure. How can I make it look like a proper bipartite graph?
sheetal_158
  • 5,868
  • 6
  • 23
  • 39
14
votes
2 answers

Solving a graph game

I've struggled some time with a problem from a programming contest (Andrew Stankevich Contest 21) about a game that goes like follows: Nick and Peter like to play the following game [...]. They draw an undirected bipartite graph G on a sheet of…
Niklas B.
  • 84,596
  • 15
  • 180
  • 217
11
votes
2 answers

Minimizing number of crossings in a bipartite graph

The following algorithm problem occurred to me while drawing a graph for something unrelated: We have a plane drawing of a bipartite graph, with the disjoint sets arranged in columns as shown. How can we rearrange the nodes within each column so…
Imre Kerr
  • 2,084
  • 10
  • 30
10
votes
3 answers

How to plot a bipartite graph in R

How do I plot a network of type bipartite in R? Similar to this: I have similar data but with weights for both genes and diseases and SARS. This network is an example. I have different kind of attributes. I followed a link here. But due to my…
Pankaj
  • 1,094
  • 2
  • 12
  • 21
10
votes
4 answers

Simplest way to plot changes in ranking between two ordered lists in R?

I'm wondering if there is an easy way to plot the changes in position of elements between 2 lists in the form of a directed bipartite graph in R. For example, list 1 and 2 are vectors of character strings, not necessarily containing the same…
dcl
  • 887
  • 1
  • 7
  • 22
9
votes
2 answers

Hopcroft–Karp algorithm in Python

I am trying to implement the Hopcroft Karp algorithm in Python using networkx as graph representation. Currently I am as far as this: #Algorithms for bipartite graphs import networkx as nx import collections class HopcroftKarp(object): …
Simon
  • 1,113
  • 2
  • 11
  • 18
9
votes
5 answers

How do I implement a Bipartite Graph in Java?

UPDATE Some answers so far have suggested using an adjacency list. How would an adjacency list look like in Java? ... no pointers right :) I'm trying to implement a Bipartite Graph in Java to sort into 2 groups information from a file. I found this…
Hristo
  • 42,002
  • 60
  • 155
  • 224
9
votes
1 answer

Bipartite network graph with ggplot2

I have the following data frame: structure(list(X1 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L ), .Label = c("1", "2",…
Dominik
  • 2,503
  • 6
  • 24
  • 31
8
votes
1 answer

Plot a bipartite plus line graph comparison

I have to plot a bipartite graph similar to this one: I have 2 ranked list computed from two different ranking method. I would like to plot this data in order to give a rough qualitative handle on the similarity of 2 ranked lists. The data I need…
andreapavan
  • 697
  • 1
  • 6
  • 23
7
votes
2 answers

Algorithm : Letters and envelopes pairing

Disclaimer : This isn't any kind of homework, the problem just came to my mind while I was going through all the Christmas cards The problem is given as follows : We've got M envelopes and N letters, each of which is described as a pair of positive…
Danstahr
  • 3,902
  • 17
  • 34
7
votes
6 answers

Visualize bipartite graph

Can someone recommend a library or code to visualize bipartite graphs in C#? Graph# seems not to support this kind of graph directly (but has some support to disentangle vertices). I want to create some graphic like this bipartite graph with some…
Mare Infinitus
  • 7,602
  • 7
  • 55
  • 106
6
votes
1 answer

Ego Graph in NetworkX

I have bipartite graph with nodes such as(a1,a2,...a100, m1,m2,...). I want to find the induced subgraph for certain nodes say(a1,a2 and a10). I can do this by using networkx.ego_graph, but it takes one vertex at one time and returns the induced…
ankshukla
  • 85
  • 10
6
votes
3 answers

networkx maximal_matching() does not return maximum matching

I'm learning to use the networkx python module to do some matchings of a bipartite graph. There are two functions in the module that give the maximum cardinality matching of a graph: nx.maximal_matching() nx.bipartite.maxmum_matching() Note that…
Jason
  • 2,064
  • 2
  • 17
  • 39
1
2 3
22 23