Questions tagged [undirected-graph]

An undirected graph has edges which have no orientation. It is a mathematical concept.

Definition of an undirected graph.

271 questions
0
votes
1 answer

How to find inlet and outlet nodes in undirected networkX graph of complicated skeleton of pathes in porous structure?

Hello! I have a networkX graph of skeleton of inner space in porous structure. I need to calculate lengths of paths between the inlet and outlet nodes. In order to do it I consider nodes with z coordinate more/less than certain number (lower and…
Andrey
  • 15
  • 4
0
votes
0 answers

path between two nodes in a graph breadth first search

I am trying to write a python program that takes input as "adjacency list (or dictionary) to represent an undirected graph", "source vertex" and "destination vertex". The program should use Breadth First Search and output all possible paths from…
0
votes
1 answer

find cycles of length 4 in undirected graph

I'm looking to print the found cycles of length 4, this code helps me correctly count the number of cycles but I also wish to print those cycles for example in this particular input graph the cycles are: 0 -> 1 -> 2 -> 3 -> 0 0 -> 1 -> 4 -> 3 -> 0 1…
0
votes
1 answer

cycle detection undirected graph with unused edges

I have an undirected graph with edges. Each edge has certain properties like one of edge between Point A and Point B is { travelTime :10hours travelPath : air } Another between Point C and Point D could be { travelTime :1hours travelPath :…
MAG
  • 2,841
  • 6
  • 27
  • 47
0
votes
1 answer

Finding the largest clique in an UnDirected Graph

Given an Undirected Graph, I need to find the largest clique. What I do is first find its size (ie how many vertices/nodes). While doing so, I remove any nodes that are not part of the largest clique (ie if max size is 3, I remove any nodes with…
EddieEC
  • 357
  • 4
  • 17
0
votes
2 answers

Cannot get "stack" to populate in DFS based task ordering program

I am writing a program that uses the recursive BFS algorithm to determine dependencies in an undirected graph. I am using a 5x5 array as an adjacency matrix to represent the graph. While debugging, I noticed that my "stack s" variable is remaining…
0
votes
1 answer

How to find connectors in a graph?

I'm struggling a bit here because quite honestly my brain is fried and I'm clueless as to what to do. My task is to find connector's in a undirected, unweighted, graph. The task claims that: In an undirected graph, vertex v is a connector if there…
0
votes
1 answer

Any efficient algorithm to find all cycles in an undirected graph?

I'm trying to find all cycles in an undirected graph and didn't find any algorithm for the same in any online sites / geeksforgeeks. There is one for directed graph (Johnson algorithm), but it isn't working (desired o/p) on undirected. Any…
user12318711
0
votes
1 answer

Maximise number of edges to cut in connected graph

This question is very similar to Leetcode's Critical Connections in a Network. Given an undirected graph, we want to find all bridges. An edge in an undirected connected graph is a bridge iff removing it disconnects the graph. Variant Instead of…
0
votes
1 answer

How to find the shortest path from vertice v to vertice w for an undirected edge-weighted graph?

Given some undirected and edge-weighted graph, what algorithm can be used to find the shortest path from some vertice v to another vertice w? For a directed edge-weighted graph, you could use Dijkstra's shortest path algorithm, but I am working…
0jnats3
  • 85
  • 1
  • 7
0
votes
2 answers

Given an MST for an edge-weighted graph, how can you find the minimally weighted path from x to y?

I have an edge-weighted undirected graph represented by a minimum spanning tree. Each vertice is represented by an integer. The MST looks like this: I wonder, how can I use this MST to find the shortest path from a vertex x to a vertex y? Say I want…
0
votes
1 answer

Sparse sets in Pyomo for representing arc / edge sets in graph/network models

I have no clue how to define an edge set in pyomo. I have a very-low-density (sparse) network (aka graph), where the number of edges is much less than a fully-connected graph. I want to define an edge set so I can construct constraints that have…
JoseOrtiz3
  • 1,785
  • 17
  • 28
0
votes
0 answers

Finding the closest special node in a weighted graph

If we are given a weighted undirected graph in which some nodes are marked as special nodes then how to find for each node v the special node with least cost to reach using Dijkstra? This solution to a problem uses this concept but i can't figure…
zahlen
  • 73
  • 2
  • 11
0
votes
2 answers

Building a Weighted Undirected Graph

I'm working on a coding challenge in Java where my driver reads in the names of cities and the mileages between them from text files. This information is then going to be passed to a method which will populate a weighted, undirected graph. The city…
user10777092
0
votes
0 answers

NetworkXNotImplemented error : connected_components() method - undirected graph

As I understand connected_components() method in NetworkX should generate components in a given undirected graph (There are strongly_connected_components() and weakly_connected_components() for directed graph). I have generated an undirected graph G…