I have a edge list as cell array
['a' 'b','c' 'b','b' 'a']
I have been trying to generate a graph in MATLAB using G=graph(s,t) but I get an error for duplicate edges which i figure is because of [a b] and [b a]. I am not able to remove those in my…
Input: a list of vertexes and an adjacency list.
Output: largest subset of good vertexes.
(We say a vertex in a subset as "good vertex" if it has at least 2 adjacent vertexes and at least 2 non-adjacent vertexes in that subset.)
Example…
I need to write a graph in a text file where each line of the file is composed from one node followed by all its neighbors. It's basically what an Adjacency List is, and what the function write_adjlist is supposed to do. Unfortunatly it's not the…
I know that for an undirected graph with n vertices to be connected it must have n - 1 edges. However, my question is what is the minimum number of edges that it can have for it to always be connected. For example, does a graph with n vertices and n…
I know that for an undirected graph with n vertices the minimum number of edges it must have for it to be connected is n - 1. However, if a graph has n vertices and n - 1 edges, is it always connected?
My question is mostly algorithm-related and not specific to a specific programming language
Assuming we have a graph represented by a list of lists, where each internal list represents two nodes and a numbered edge, Is is possible to implement a…
this is an example problem from an old midterm:
Let G = (V, E) be a connected undirected graph where the edges have positive integer edge weights associated with them, and a vertex s ∈ V is the source. Provide an algorithm that for each vertex t ∈ V…
If a directed Edge is implemented something like:
class EdgeImpl(origin: Node, dest: Node) {
def from = origin
def to = dest
}
then which is the difference for implementing an undirected Edge while when we create a new Edge we also have…
I am trying to come up with a greedy algorithm in Python that returns the vertices in an undirected graph given a certain starting vertex. I understand that DFS determines if a cycle exists, but I am trying to actually return the vertices that form…
I am currently writing a program using an undirected graph. Im representing this by creating an adjacency matrix of the connections.
if(adjacency_matrix[i][j] == 1){
//i and j have and edge between them
}
else{
//i and j are not…
I have a undirected graph which is connected. How could it be made biconnected adding minimum number of edges?
I tried searching online for this particular algorithm and also tried thinking myself but couldn't figure out anything. Pseudocode would…
I have an edgelist of an undirected graph structure.
data <- data.frame(i = c("var1","var3","var5","var7","var7","var7","var11"),
j = c("var2","var4","var6","var8","var9","var10", "var1"))
head(data)
i j
1 var1 var2
2…
I want to find first cycle in an undirected graph using BFS only(NOT DFS). All sources solved this problem with DFS but I have to find it using BFS. How can I find it? Thanks in advance!
This is my first question here as I've usually found helpful answers by searching previous posts. I cannot find any that relate to my particular problem this time. I need to complete a branch and bound function in Python (it's for a Coursera…
I'm working on a algorithm that models a electric grid as a Undirected Multigraph so I can analyse the faults on the grid using python.
I have the functions that get me all the minimum paths (paths that do not loop) between two nodes and need to get…