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
3
votes
2 answers

Prove upper bound of O(log n) on the maximum outdegree of an undirected graph turned into a directed one by this algorithm

Some definitions first: an "accumulated graph" is a graph where edges are added to it later on. The topic is orientation problem (making an undirected graph directed), when our goal is to make the maximum out-degree the lowest possible. Now, they…
John Smith
  • 63
  • 1
  • 1
  • 9
3
votes
2 answers

Prove a property of Minimum Spanning Tree

I need your help proving the following: G=(V,E) is an undirected connected graph with non-negative weights on the edges. Let T be a MST of G and T' be a spanning tree of G (not a minimum one) so it holds that Weight(T') > Weight(T). Prove that the…
Noam
  • 1,640
  • 4
  • 26
  • 55
2
votes
0 answers

Is there an efficient way to find nested biconnected components in a biconnected graph

I have a biconnected graph (i.e., an undirected graph where removing any single vertex leaves the graph connected). I would like to find the "nested bidirected subgraphs," meaning that the subgraph is biconnected when examined by itself, and it's…
user1806566
  • 1,078
  • 6
  • 18
2
votes
3 answers

Finding Cycles in an Undirected Graph

It is necessary to implement a swi-prolog program that implements the search for all cycles in an undirected graph and outputs the result without repetitions. Example: ?-find_cycles([a-[b,c,d],b-[a,c],c-[a,b,d],d-[a,c]]) Result: Cycle =…
2
votes
1 answer

Throw an error if multiple shortest paths are found

Given an undirected weighted graph, a start, and an end point. You need to find the shortest path to that end point, but throw an error if multiple shortest paths are found. How would we do the error part? Is there a way to check if multiple…
2
votes
2 answers

Converting a grid into a weighted adjacency list

const grid = [ [0, 1, 2], [3, 4, 5], [6, 7, 8] ] In the grid above, traversing left to right has a cost of 10 and up to down has a cost of 25. I'd like to represent this in a undirected weighted adjacency list like below: const weightedAdjList =…
2
votes
1 answer

Calculate the f cost in A*(A-star) algorithm on coordinated undirected graph

I'm trying to implement A* algorithm in react.js but I'm quite stuck when it comes to implement the fScore function. I know that f=g+h where g is the gScore from the start node till the current node and h is the heuristic distance from the…
2
votes
1 answer

How to find if a path exists between two given vertex JAVA

Im trying to write a method to find whether or not a path exists between to vertex in an undirected graph that is representned in an adjacency matrix. This is the adjacency matrix that I have: int[][] adj_matrix ={{0,1,0,0}, …
2
votes
0 answers

Is there any module available in Erlang to find all the cycles of an undirected graph?

For a directed graph, we have the following module: digraph_utils:cyclic_strong_components(G) Is there anything like this available for undirected graphs in Erlang? I want to find all the cycles in an undirected graph. Is there a method by which I…
2
votes
1 answer

How do I extract the trees from a graph using Answer Set Programming?

There is an undirected graph (V,E), weights on the edges w : E → N, a target k ∈ N, and a threshold O ∈ N. Find a k-vertices tree of the graph of weight less than the threshold. In other words, select k vertices and k - 1 edges from V and E…
2
votes
1 answer

Largest empty subgraph of an undirected graph in SWI Prolog

An undirected graph is given. Find the number of internal stability of the graph. That means finding the power of the largest empty subgraph. (The empty subgraph is one with no vertices directly connected by edges). I set the edges and vertices.…
2
votes
2 answers

Algorithm to find any two nodes with distance of at least half the (undirected) graph's diameter

I have to give an algorithm as follows: Given an undirected connected graph G, give an algorithm that finds two nodes x,y such that their distance is at least half the diameter of the Graph. Prove any claim. I'm assuming I have to run a BFS from any…
user11333043
2
votes
1 answer

Pytorch geometric Data object edge_attr for undirected graphs

How would one construct a edge_attr list for undirected graphs in pytorch geometric Data object. Say we had an undirected graph such as this one. The graph COO matrix required by the pytorch geometric object is: [['a', 'b', 'a', 'c', 'b', 'c'] …
3michelin
  • 81
  • 2
  • 9
2
votes
1 answer

Single source shortest path using BFS for a undirected weighted graph

I was trying to come up with a solution for finding the single-source shortest path algorithm for an undirected weighted graph using BFS. I came up with a solution to convert every edge weight say x into x edges between the vertices each new edge…
2
votes
1 answer

Counting undirected edges between any two nodes

I'm trying to generate an edge list to feed into R's igraph plotting function, which requires that I generate a data.frame' objective consisting of two columns representing "from" node and "to" node with other columns serving as edge…
Chris T.
  • 1,699
  • 7
  • 23
  • 45
1
2
3
18 19