Several shortest paths

**Floyd Find the shortest path O(N³)** Given a digraph with n points and m edges, there may be multiple edges and self rings, and the edge weight may be negative. Given k queries, each query contains two integers x and y, representing the shortest distance from point x to point y, If the path does not exist, outp ...

Posted on Sun, 05 Dec 2021 06:19:10 -0500 by khalidorama

2-3 Importance calculation for nodes in social network diagrams (25 points)

2-3 Importance calculation for nodes in social network diagrams (25 points) In social networks, individuals or units (nodes) are connected by certain relationships (edges). They are affected by these relationships, which can be interpreted as an interaction that spreads between interconnected nodes in the network and can be enhanced or weakene ...

Posted on Tue, 30 Nov 2021 12:53:52 -0500 by vB3Dev.Com

Joint query set 1 & dfs & bfs & unionMerge & bipartite graph

0 some basics Judge whether the whole graph is connected Use dfs to judge whether the whole graph is connected: // if not connected, return false vecctor<int> stack = {0}; vector<bool> vis(graph.size(), false); vis[0] = true; int visCnt = 1; // dfs to check if connected whil ...

Posted on Mon, 29 Nov 2021 13:23:28 -0500 by php_tom

Isomorphism identification of Graphs

Given two adjacency matrices, judge three necessary and insufficient conditions: ① Same number of nodes ② Same variable ③ The number of nodes with the same degree is the same Carry out matrix transformation on the premise of ①, ② and ③ to see whether one of the given two matrices can be transformed into another matrix; Implementation code and ...

Posted on Fri, 26 Nov 2021 02:10:15 -0500 by kanika

20211123 HDU exercise shortest path and minimum spanning tree

Some template titles are dijkstra and prim I'm sorry to copy and paste the experiment report the first time I write a blog. I'll do it well next time. () In the future, I will also write some questions.   Welcome to play with me~ HDU Today Time Limit : 15000/5000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total S ...

Posted on Mon, 22 Nov 2021 19:35:33 -0500 by slamMan

acwing 903. Expensive bride price is the shortest path with constraints

Title: The young Explorer came to an Indian tribe. There he fell in love with the chief's daughter, so he asked the chief to marry him. The chief asked him to use 10000 gold coins as a bride price before he agreed to marry his daughter to him. The Explorer couldn't get so many gold coins, so he asked the chief to lower his requirements. Th ...

Posted on Sat, 20 Nov 2021 22:15:54 -0500 by TomT

Data structure graph theory

DFS connected P352 connected component (undirected graph), strongly connected component (directed graph) pata1034 head of a gang Core code: void dfs( int u,int& head,int &numMember,int &totalvalue )//head, numMember and totalvalue change with each recursive dfs, but their final results are subject to the last recursive (without ...

Posted on Sat, 20 Nov 2021 00:57:06 -0500 by TimTimTimma

NOIP 2012 cultural tour

I saw that the data of this problem mentioned in Luogu was especially water, so I wrote a very water approach. Title: P1078 [NOIP2012 popularization group] cultural tour - New Ecology of computer science education in Luogu (luogu.com.cn) Topic background This problem is wrong. It was later proved that there is no reliable practice of polynom ...

Posted on Fri, 19 Nov 2021 13:47:17 -0500 by pbarney

Data structure code Title ------- figure < Day01 >

Data structure code - Chart From the beginning of this blog, we have come to the code part of graph structure. For graph related code, we mainly focus on depth first and breadth first traversal algorithms. Let's first introduce the breadth first traversal algorithm. Introduction to breadth first algorithm 1. Diagram structure representati ...

Posted on Tue, 16 Nov 2021 11:24:06 -0500 by hkay1

[CodeJam 2021 Round 3] Square Free

problem Shinaiko is an old woman who loves playing mahjong. One day she put her mahjong into a n × m n\times m n × In the grid diagram of m, each mahjong can be placed in the grid obliquely to the left (e.g ...

Posted on Tue, 16 Nov 2021 09:18:29 -0500 by egalp