# What algorithm can I use to locate bottleneck paths in an undirected graph?

Advertisements Given an undirectional graph, how would you be able to efficiently find all of its "bottleneck" paths? A "bottleneck" path is defined as a path that if destroyed, causes the graph to split into 2 non-connected graphs. Algorithm for finding bottleneck paths in an undirectional graph. Could not find such algorithm. >Solution : I’m… Read More What algorithm can I use to locate bottleneck paths in an undirected graph?

# Im trying to convert an Int to a boolean for code. Is there a workaround?

Advertisements Im making a program that takes vertices from a text file and creates a graph. The code takes in a text file with edges, constructs a graph using adjacency list data structure, then finally uses Depth first search (DFS) for searching the graph. Here is my code: import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import… Read More Im trying to convert an Int to a boolean for code. Is there a workaround?

# For loop that switches between two graphs

Advertisements I have a graph called testg testg = nx.Graph() testg.add_nodes_from([1,2,3,4]) testg.add_edges_from([(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)]) It looks like this: I want to remove each node, using a loop, and see if the resulting graph is connected. I know it will be, but in my real problem that’s not the case. I think it makes sense to recreate the… Read More For loop that switches between two graphs

# Add nodes in a Graph not working perfectly in js

Advertisements I have created a graph which containing key and value pair ,key is for node number and value for adjacency list value which is an array of adjacent edges, here I wrote a function that will add the node and adjacency edges in the graph, but here the function is not working ,which thing… Read More Add nodes in a Graph not working perfectly in js

# Trying to append an array value inside a Dictionary<string,string[]>

Advertisements For some reason I cannot append a string variable to string[] value in Dictionary<string;string[]> I am trying to make a Graph C# class for practice and i ran into a problem: I use Dictionary<string, string[]> graph to make a structure like this: "Node1":[connection1,connection2,connection3] "Node2":[connection1,connection2,connection3] "Node3":[connection1,connection2,connection3] … I have a method to append a connections… Read More Trying to append an array value inside a Dictionary<string,string[]>

# Longest chain of points satisfying given condition

Advertisements I have a graph of discrete set of points. y x 0 1.000000 1000.000000 1 0.999415 1000.000287 2 0.999420 1000.000358 3 0.999376 1000.000609 4 0.999239 1000.000788 5 0.999011 1000.000967 6 1.000389 1000.001433 7 0.999871 1000.001756 8 0.995070 1000.002723 9 0.996683 1000.003404 I want to determine the longest chain of consecutive points where the slope… Read More Longest chain of points satisfying given condition

# Python – How to convert a List into an Adjacency List for graphs structure

Advertisements My problem is that I can’t convert a graph constructed through a list into a graph constructed as a dictionary, which must act as an adjacency list. I have already constructed a random generated graph by randomly adding to each edge: start node (string), end node (string), weight (int). But now I would need… Read More Python – How to convert a List into an Adjacency List for graphs structure

# Change the multi-label X-axis label in R

Advertisements i have this code library(dplyr) library(tidyr) library(ggplot2) library(ggprism) MLE <- c(0.01866, 0.015364, 0.015821, 0.008736, 0.008433, 0.008655, 0.003426, 0.003403, 0.00352) KS <- c(0.021095, 0.016748, 0.017564, 0.010222, 0.009470, 0.009559, 0.003929, 0.003907, 0.00396) AD <- c(0.020344, 0.016381, 0.016299, 0.009494, 0.008962, 0.009009, 0.003645, 0.003625, 0.003698) CS <- c(0.021689, 0.017805, 0.017741, 0.010436, 0.009783, 0.00986, 0.004007, 0.004073, 0.00404) df <-… Read More Change the multi-label X-axis label in R

# remove same combinations in dataframe pandas

Advertisements I have a dataframe that is a edgelist for a undirected graph it looks like this: node 1 node 2 doc 0 Kn Kn doc5477 1 TS Kn doc5477 2 Kn TS doc5477 3 TS TS doc5477 4 Kn Kn doc10967 5 Kn TS doc10967 6 TS TS doc10967 7 TS Kn doc10967 How… Read More remove same combinations in dataframe pandas

# Can't solve this for loop

Advertisements So I’m a beginner and I need to write a code that prints a x-y graph. Here is my code: dimx = int(input(‘lengte van de x-as: ‘)) dimy = int(input(‘lengte van de y-as: ‘)) b = int(input(‘b: ‘)) print("^") for x in range(dimy): print("|") if x == b+1: for x in range(dimx): print("-",end="") print("+"+"-"*dimx… Read More Can't solve this for loop