graph-theory

Finding crossing numbers: Drawing a bipartite graph using Python turtle

Finding crossing numbers: Drawing a bipartite graph using Python turtle Question: At first I must say I am from Mathematics background and I have a very little knowledge about programming in Python. I am working on drawing complete bipartite graph with minimum number of crossings. For example: K(4,4) the complete bipartite graph with 8 vertices …

Total answers: 2

Pandas Convert Dataframe to Employee/Supervisor Hierarchy

Pandas Convert Dataframe to Employee/Supervisor Hierarchy Question: I have a dataframe that is very similar to this question with the caveat that: An employees level is not known The order of employees is random Because of (1) and (2), there may instances where the employee is parsed before their supervisor I was using this answer …

Total answers: 1

Connect lines that have common points

Connect lines that have common points Question: I have a list of lines like this: Lines = [‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’] each line has two points I and J: LinesDetail = { ‘1’: { ‘I’: ‘100’, ‘J’: ‘101’}, ‘2’: { ‘I’: ‘101’, ‘J’: ‘102’}, ‘3’: { ‘I’: ‘256’, ‘J’: ‘257’}, ‘4’: …

Total answers: 2

Is it possible to do a depth first search iteratively without copying visited nodes?

Is it possible to do a depth first search iteratively without copying visited nodes? Question: Background I am searching a 2D grid for a word. We can search left/right and up/down. For example, in this grid, searching for "abef" starting at (0,0) will return True Example (grid1): Where I’m at The recursive version gives expected …

Total answers: 2

How to group a pandas dataframe by array intersection

How to group a pandas dataframe by array intersection Question: Say I have a DataFrame like below UUID domains 0 asd [foo.com, foo.ca] 1 jkl [foo.ca, foo.fr] 2 xyz [foo.fr] 3 iek [bar.com, bar.org] 4 qkr [bar.org] 5 kij [buzz.net] How can I turn it in to something like this? UUID 0 [asd, jkl, xyz] …

Total answers: 2

Find all shortest paths between all pairs of nodes in NetworkX

Find all shortest paths between all pairs of nodes in NetworkX Question: I am trying to get all shortest paths between all pairs of nodes in an undirected unweighted graph. I am currently using nx.all_pairs_shortest_path(), but I don’t understand why it only returns one shortest path for every pair of nodes. There are cycles in …

Total answers: 4

How to find the shortest path between two coordinates in a 2-dimensional array?

How to find the shortest path between two coordinates in a 2-dimensional array? Question: I am trying to find the shortest way to get from one point in a 2D array (one coordinate with x and y values representing its position in the array) to another. I would like to output an array of coordinates …

Total answers: 1