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

Undirected graph gradually remove all points but not create 2 graphs

Cities are connected by telephone wires and communicating. I want destroy all cities but not alarm another too early, so i disconnect wire before destroying town. I don't want disconnect town what is used as bridge between two cities. It is…
user7757483
0
votes
1 answer

How to make an undirected and unweighted graph in the shape of a grid in C++

I'm trying to implement a for loop to initialize a graph in the shape of a grid, including diagonals. Basically, I have an array that is initialized with values that I want to replicate in the graph. So I have a nested for-loop that has several if…
0
votes
1 answer

What's the difference between undirected graph and unweighted graph? Are they the same thing?

What's the difference between undirected graph and unweighted graph? Are they the same thing? Just want to be 100% sure. I'm new to all this. Please don't lock I just need help and would like to learn.
adam
  • 7
  • 1
  • 7
0
votes
1 answer

Handshaking lemma with 3 people?

Handshaking lemma states in an undirected graph an even number of vertices must have odd degree. However 3 people shaking hands with each other, 6 hand shakes, or two a each. So there are no vertices with odd degree. Does the handshaking lemma hold…
user1768079
  • 683
  • 3
  • 10
  • 18
0
votes
1 answer

Avoiding infinite recursion but still using unbound parameter passing only

I have the following working program: (It can be tested on this site: http://swish.swi-prolog.org, I've removed the direct link to a saved program, because I noticed that anybody can edit it.) It searches for a path between two points in an…
0
votes
2 answers

Convert a binary tree to corresponding undirected graph

Given a representation of a binary tree which can have the maximum of n nodes: typedef struct node { int info,n; struct node *left,*right; }tree_node; Construct an undirected graph from a binary tree which can have the maximum of n nodes. Graph…
ufo
  • 93
  • 1
  • 11
0
votes
2 answers

Make undirected graph from adjacency list

I'm trying to make an undirected graph from an adjacency list to practice the Karger's Min Cut algorithm. The following is my code class Vertex(object): '''Represents a vertex, with the indices of edges incident on it''' def…
Effective_cellist
  • 1,098
  • 1
  • 19
  • 39
0
votes
0 answers

Set of all pairwise matchings in an undirected, unweighted graph

So, I am relatively new to Python and programming in general. However, I have an undirected graph without weights. Some nodes are connected, some not. Some have just one connection, some will have multiple. Each node represents an individual that…
0
votes
1 answer

Undirected graph in Java with unknown number of vertices

I am trying to create an undirected graph in Java with a "live feed" of vertices. I have the vertices coming in from a txt file. The file is structured like this, 1 2 #connect node 1 with node 2 2 3 #connect node 1 with node 2 and so on. I have…
0
votes
1 answer

Unique paths undirected cyclic graph

I am working on a problem in graphs and trying to figure out on finding unique paths let me give an example, let us consider a graph with 4 nodes and 6 edges with edges as follows - 1 2 2 3 3 4 4 1 1 3 2 4 the unique cyclic paths of length 5 will…
joe bill
  • 1
  • 2
0
votes
1 answer

How can Dijkstra's algorithm apply to both undirected and directed algorithm in one program?

The graph is represented in the format as below: MAX 12 NODE 1 1 NODE 2 2 NODE 3 3 NODE 4 4 NODE 5 5 NODE 6 6 NODE 7 7 NODE 9 9 NODE 8 8 NODE 10 10 NODE 11 11 NODE 12 12 EDGE 1 2 EDGE 2 3 EDGE 3 4 EDGE 4 5 EDGE 5 6 EDGE 6 7 EDGE 7 8 EDGE 8 9 EDGE 9…
NUO
  • 247
  • 2
  • 3
  • 14
0
votes
1 answer

Most efficient algorithm to know if undirected graph is connected

I´ve been trying to find an algorithm to search if a graph is connected. The graph is undirected and I only want to find a solution (there can be multiple) or if there is none. I was looking for a alg. that performs near linear time, maybe O(logN)…
0
votes
1 answer

Using DFS in Adjacency list and using a pointer array of pointers

I am trying to create a C program that reads in an input file that contains a set of points representing edges of an undirected graph. I am trying to store each vertex struct in an array that is implemented using a pointer, however the array does…
0
votes
1 answer

Proper traversal of undirected graph using depth first search?

I've got an undirected graph that I need to traverse using depth first search. The excel chart below shows each node has been marked after traversal in the marked column, and the edgeTo column shows which node brought us to that node. For…
Omar N
  • 1,720
  • 2
  • 21
  • 33
0
votes
2 answers

How to group/List all nodes of a undirected graph using teradata sql

I have data for many diff. set of undirected graphs in a table (like adjacent list relationship, one node is connected which all node) and I need to group all individual undirected graphs. Eg: all nodes of the particular undirected graphs will be in…