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
0 answers

How can I dynamically populate an undirected graph with C# classes using JavaScript in Razor pages?

I need some help in dynamically providing data to my undirected graph. I want to use classes that are written in C# for the links and nodes. The visual representation is done in JavaScript inside a Razor page. This is what I have tried until now,…
0
votes
0 answers

Adjacency Matrix for Undirected Graph (Collaboration network of Arxiv General Relativity)

I want to use MATLAB to create the adjacency matrix for the following undirected graph data in this link. When I apply "graph" function, I get the error that the matrix has duplicate edges. When I investigated the uniqueness of rows, all the rows…
AMGEO
  • 13
  • 4
0
votes
0 answers

How to turn an undirected graph with multi source to an DAG?

I have a undirected acyclic graph, which expressed by adjacency list, such as below. {A: C} {B: D} {C: A,D} {D: C,B,E} {E: D,F,G} {F: E} {G: E} My problem is: above undirected acyclic grapgh has multi independent source vertexes, which are A and B,…
0
votes
0 answers

Read a text file which consists of the edges of the Graph and perform BFS, DFS, and Shortest Path Algorithm (Dijkstra) in Java

I've been stuck in the addEdge method of my Graph class where instead of having only one "A" Vertex in my Arraylist, it creates a new one for another edge. For example here is my text file: A,F,2 A,C,6 B,G,4 B,H,5 C,D,8 C,F,5 D,A,1 So instead of…
0
votes
0 answers

Find all nodes up to distance K from target node

I have an undirected, acyclic graph with N nodes and N-1 edges. I have a function where I get a node, A. I need to update all nodes which are at distance D or less away from A (for example, if D is 2, I need to update all nodes which can be reached…
Redz
  • 324
  • 1
  • 4
  • 16
0
votes
0 answers

Is there a best practice for accessible keyboard navigation through an undirected graph

TL;DR: Is there a recommended best practice to make keyboard navigation through an undirected graph accessible for visually impaired people? I am currently working on an HTML based application that displays an undirected graph of buttons. Buttons…
Oliver Tacke
  • 332
  • 4
  • 12
0
votes
2 answers

Is a single node after dividing a graph still considered a subset?

For example: enter image description here Dividing between A and B: enter image description here Would DAC and B be considered two subsets? I am trying to create two subsets from an initial graph of 4 nodes.
0
votes
0 answers

Constructing a 3-D weighted & undirected similarity graph

I am a newbie in using python and I am in need of some help. I am trying to built a weighted and undirected k-nearest-neighbors graph for a given 13-dimensional dataset containing 200 data points. For a start, I created an 3-dimensional embedding…
ksl
  • 1
0
votes
0 answers

Graph Connection (Undirected Graph)

Date Modified: 06/11/2022 Hi everyone! So I have edited my DFS algorithm. However, despite my best efforts, my code is STILL unable to pass all hidden test cases and I'm genuinely not sure how to further improve the code, advice would be…
0
votes
1 answer

Reading a text file into an undirected graph using adjacency list

I am trying to create an undirected graph using a text file with the following format: 0 5 4 3 0 1 9 12 6 4 5 4 0 2 11 12 I made a method to read the file and insert nodes/vertices into an arraylist. Each node/vertex has its own linked list within…
Florence
  • 9
  • 2
0
votes
3 answers

Create a graph if nodes are not continuous c++

Consider this situation: (undirected graph) we dont have number of nodes but have the edges like 1<->3 , 6<->7, 3<->7. So how do we declare a graph using this? Generally we have n that is no. of node and e edges but in this case we only have e edges…
Parikshit
  • 21
  • 1
  • 5
0
votes
1 answer

How to find the maximum number of pair of nodes that can be matched in a graph?

I am trying to find a way in Python to pair up nodes in an undirected graph such that the maximal amounts of nodes is reached, while no node appears more than once. Example: Input1: Graph with 3 nodes and edges [A, B], [A, C], [B, C] Output1: should…
Andrew.M
  • 90
  • 1
  • 7
0
votes
1 answer

Algorithm to find all path between two nodes in an undirected weighed graph

I have an undirected graph like this: let list = new Map([ ["A", [["B", "rdWeight"], ["C", "rdWeight"]]], ["B", [["A", "rdWeight"], ["E", "rdWeight"]]], ["C", [["D", "rdWeight"], ["A", "rdWeight"]]], ["D", [["C", "rdWeight"], ["E",…
0
votes
2 answers

Finding a graph based algorithm to clean a room with some robots in the shortest time. The map/maze is given

I need help solving the following problem: Given a room (matrix), where each square can be: a dirty spot that needs to be cleaned, an empty spot, a wall, or a starting position for a robot, I need to find the fastest way my robot network can clean…
Elena
  • 1
0
votes
0 answers

Get Connected Components in an undirected graph - Python

I want to get all connected subgraph of the graph graph = {1: [3, 4], 2: [5, 8], 3: [4, 1], 4: [1, 3], 5: [2, 8], 6: [7, 9], 7: [6, 10, 9], 8: [2, 5], 9: [7, 6, 10], 10: [7, 9]} for example I have this graph dictionary, the function should return…