算法 {算法术语,自定义算法术语}

图论

定义

某点的搜索图

A Search-Graph of a point a a a (a点的搜索图) ( V , E ) (V, E) (V,E) where a a a can reach to any point ∀ x ∈ V \forall x \in V xV and E E E is the edges of the Induced-Sub-Graph G [ V ] G[V] G[V].
. + When we perform a BFS/DFS from the start-point a a a, actually, we are traversing on the Search-Graph of a a a.

某点的极限路径

A Limited-Path of a point s s s (s点的极限路径) is a path s → . . . → t s \to ... \to t s...t where each time we traverse an edge a → b a\to b ab then delete this edge a → b a\to b ab (if in the Undirected-Graph, then delete its corresponding-edge a − b a-b ab), until we arrive at the point t t t which has no adjacent-point to traverse further.
. + Finally, in the new graph (all edges in the path has been deleted), the O u t [ t ] = 0 Out[t] = 0 Out[t]=0 (if in the Undirected-Graph, then D e g [ t ] = 0 Deg[t] = 0 Deg[t]=0);
. + It can be got by DFS using the below method:

void DFS( int a){
	for( `(a-x)` : all adjacent-edges of `a`){
		path.push_back( `(a-x)`);
		delete this edge `a-x` from the graph;
		DFS( x);
	}
}

数论

线性同余方程
LCE: Linear-Congruence-Equation (线性同余方程) a x ≡ b ( % M ) ax \equiv b (\% M) axb(%M)

@Delimiter

裴蜀方程

BezoutE: Bezout-Equation (裴蜀方程) is the form a x + b y = c ax + by = c ax+by=c where a , b , c > 0 a,b,c > 0 a,b,c>0 are Constants, and x , y ∈ Z x,y \in Z x,yZ are Unknowns;
. A pair ( x 0 , y 0 ) (x_0, y_0) (x0,y0) satisfying the equation is called a Solution;

算法术语缩写

数论

MatrixMul 矩阵乘法

CRT: 中国剩余定理

CRT_EX: 拓展中国剩余定理

@Delimiter

LCE_BezoutE: 使用裴蜀方程法 来求解 线性同余方程;

@Delimter

BezoutE: 求解 裴蜀方程;

@Delimiter

EulerFunc: Euler-Function (欧拉函数)

--

MulInv: Multiplicative-Inverse (乘法逆元)

--

BinExp: Binary-Exponentiation (快速幂)

--

GCD: Greatest-Common-Divisor (最大公约数)

--

GCD_EX: Extended-GCD (拓展GCD算法)

--

LCM: Least-Common-Multiple (最小公倍数)

@Delimiter(Old)

图论

DFS图

树Tree

@Todo: (all leaves are Degree[] = 1 without the choice of root) or (if you choose a root, the root maybe a leaf)

有向图DiG

有向无环图DAG

Directed-Acyclic-Graph (DAG) (有向无环图) is a Directed-Graph where has no Circuit.

--

(路径点覆盖) is a set of Simple-Paths such that all points occurs in exactly One path;
+ Let V = ( 1 , 2 , 3 ) V = (1,2,3) V=(1,2,3), then ( 1 → 2 → 3 ) (1\to2\to3) (123) is valid; ( 1 → 2 ) ( 3 ) (1\to2) (3) (12)(3) is valid; while ( 1 → 3 ) ( 2 → 3 ) (1\to 3) (2\to 3) (13)(23) is not, ( 1 → 2 ) (1\to 2) (12) is also not;

(最小路径点覆盖) is that with the minimal paths;

--

(路径重复点覆盖) is a set of Simple-Paths such that all points occurs in at least One-Path;
+ Any 路径点覆盖 is also 路径重复点覆盖;
+ Let V = ( 1 , 2 , 3 ) V = (1,2,3) V=(1,2,3), then ( 1 → 3 ) ( 2 → 3 ) (1\to3) (2\to 3) (13)(23) is valid;

(最小路径重复点覆盖) is that with the minimal paths;


(路径独立集): in Directed-Graph, it is a set of points where any two points are not accessible to each other;
+ It differs from Independent-Set which applicated in Undirected-Graph and two points are not forms an Edge (not Path)

最大路径独立集

基础概念

A point a a a is called Reachable (可达) for b b b if there exists a Path b → . . . → a b \to ... \to a b...a (also b b b could Reach to a a a)

. As a lemma, any point is Reachable for itself.


Two points a , b a,b a,b are called Weakly-Connected (弱连通) if replacing all directed-edges with undirected-edges produces a path between a , b a,b a,b.

. ( a → b ) ( c → b ) (a\to b) (c\to b) (ab)(cb) where a , c a, c a,c are Weakly-Connected.


Two points a , b a,b a,b are called Unilaterally-Connected (Semi-Connected) (半连通/单向连通) if there exists a path a → . . . → b a \to ... \to b a...b or b → . . . → a b \to ... \to a b...a (another phrase, a a a is Reachable for b b b or b b b is Reachable for a a a).

. ( a → b ) ( b → c ) (a\to b) (b\to c) (ab)(bc) where a , c a, c a,c are Semi-Connected.


Two points a , b a,b a,b are called Strongly-Connected (强连通/双向连通) if they are Reachable for each other.


A graph G = ( V , E ) G = (V,E) G=(V,E) is called Weakly-Connected (弱连通) if any two points a , b a,b a,b are Weakly-Connected ∀ a , b ∈ V \forall a,b \in V a,bV (another phrase, if transforming each edge in E E E being Undirected, then the undirected-graph G G G is Connected.)

A Weakly-Connected-Sub-Graph (弱连通子图) G 1 G1 G1 of G G G is Weakly-Connected and G 1 ⊂ G G1 \subset G G1G.


A graph ( V , E ) (V,E) (V,E) is called Semi-Connected if any two points a , b a,b a,b are Semi-Connected ∀ a , b ∈ V \forall a,b \in V a,bV

A Semi-Connected-Sub-Graph (强连通子图) G 1 G1 G1 of G G G is Semi-Connected and G 1 ⊂ G G1 \subset G G1G.


A graph ( V , E ) (V,E) (V,E) is called Strongly-Connected if any two points a , b a,b a,b are Strongly-Connected ∀ a , b ∈ V \forall a,b \in V a,bV

A Strongly-Connected-Sub-Graph (强连通子图) G 1 G1 G1 of G G G is Strongly-Connected and G 1 ⊂ G G1 \subset G G1G.

. Strongly-Connected, always implies that is also Semi-Connected; Semi-Connected, always implies that is also Weakly-Connected;


A Weakly-Connected-Component (弱连通分量/极大弱连通子图) G 1 G1 G1 is a Weakly-Connected-Sub-Graph of G G G such that there not exists another Weakly-Connected-Sub-Graph G 2 G2 G2 satisfying G 1 ⊂ G 2 G1 \subset G2 G1G2

. e.g., G = ( 1 → 2 ) ( 2 → 3 ) ( 1 → 3 ) ( 4 ) G = (1\to 2) (2\to 3) (1\to 3) (4) G=(12)(23)(13)(4), then ( 1 → 2 ) ( 2 → 3 ) ( 1 → 3 ) (1\to 2) (2\to 3) (1\to 3) (12)(23)(13) is Weakly-Connected-Component (which is also a Closed-Sub-Graph, but the converse is not), while ( 1 → 2 ) ( 2 → 3 ) (1\to 2) (2\to 3) (12)(23) is not.

These WCC (Weakly-Connected-Component) of any graph are unique, let them be W C C 1 , . . . , W C C k WCC1, ..., WCCk WCC1,...,WCCk, there are some properties:
+ Every point and edge must belong to exact one W C C i WCCi WCCi (this can be proved according to the corresponding C C CC CC of Un-G).
+ k k k is called the number of W C C WCC WCC of G G G. If we shrinking all SCC, then k k k equals to the number of DAGs.

--

A Semi-Connected-Component (半连通分量/极大半连通子图) G 1 G1 G1 is a Semi-Connected-Sub-Graph of G G G such that there not exists another Semi-Connected-Sub-Graph G 2 G2 G2 satisfying G 1 ⊂ G 2 G1 \subset G2 G1G2

These SECC (Semi-Connected-Component) of any graph are unique, let them be S E C C 1 , . . . , S E C C k SECC1, ..., SECCk SECC1,...,SECCk, there are some properties:
+ For the view of DAG (shrinking all DAGs), S E C C i SECCi SECCi is a path from s → . . . → e s \to ... \to e s...e where s s s is a start-point of DAG and e e e is a end-point of this DAG.
+ Every edge must belong to exact one W C C i WCCi WCCi.
+ Every point belongs to multiple ( ≥ 1 \geq 1 1) W C C WCC WCC (e.g., a → b , c → b a\to b, c\to b ab,cb there are two SECC G [ a , b ] G[a,b] G[a,b] and G [ b , c ] G[b,c] G[b,c] (the denotation of Induced-Sub-Graph)

--

A Strongly-Connected-Component (强连通分量/极大强连通子图) G 1 G1 G1 is a Strongly-Connected-Sub-Graph of G G G such that there not exists another Strongly-Connected-Sub-Graph G 2 G2 G2 satisfying G 1 ⊂ G 2 G1 \subset G2 G1G2

. e.g., G = ( 1 → 2 ) ( 2 → 1 ) ( 2 → 3 ) ( 3 → 2 ) ( 4 ) G = (1\to 2) (2\to 1) (2 \to 3) (3 \to 2) (4) G=(12)(21)(23)(32)(4), then ( 1 → 2 ) ( 2 → 1 ) ( 2 → 3 ) ( 3 → 2 ) (1\to 2) (2\to 1) (2\to 3) (3 \to 2) (12)(21)(23)(32) is Strongly-Connected-Component , while ( 1 → 2 ) ( 2 → 1 ) (1\to 2) (2\to 1) (12)(21) is not.

These SCC (Strongly-Connected-Component) of any graph are unique, let them be S C C 1 , . . . , S C C k SCC1, ..., SCCk SCC1,...,SCCk, there are some properties:
+ Every point must belong to exact one S C C i SCCi SCCi.
+ Any edge either belong to exact one S C C i SCCi SCCi or none (e.g., G = ( a → b ) G = (a\to b) G=(ab) and two S C C 1 = ( a ) , S C C 2 = ( b ) SCC1 = (a), SCC2 = (b) SCC1=(a),SCC2=(b) where the only edge do not belongs to any S C C SCC SCC.

--

The (Weakly/Semi/Strongly)-Connected-Component is also a Induced-Sub-Graph (i.e., WCC, SECC, SCC can be specified just by its points), but the converse is not (cuz a Induced-Sub-Graph maybe not Connected; e.g., G = ( a ) ( b ) G=(a) (b) G=(a)(b) where G G G is a Inducted-Sub-Graph of G G G but not connected)

----

A Sub-Graph (子图) G 1 = ( V 1 , E 1 ) G1 = (V1, E1) G1=(V1,E1) of G = ( V , E ) G = (V,E) G=(V,E) denoted G 1 ∈ G G1 \in G G1G and satisfying that V 1 ∈ V , E 1 ∈ E V1 \in V, E1 \in E V1V,E1E.

. A sub-graph may be somewhat strange, e.g., V 1 V1 V1 is empty-set and E 1 E1 E1 is not empty.


A Spanning-Sub-Graph (生成子图) G 1 = ( V 1 , E 1 ) G1 = (V1, E1) G1=(V1,E1) is a Sub-Graph of G = ( V , E ) G = (V, E) G=(V,E) such that V 1 = V V1 = V V1=V.


A Induced-Sub-Graph (导出子图) G 1 = ( V 1 , E 1 ) G1 = (V1, E1) G1=(V1,E1) is a Sub-Graph of G = ( V , E ) G = (V, E) G=(V,E) such that for every pair points a , b a,b a,b in V 1 V1 V1, any edge ( a → b ) ∈ E (a\to b) \in E (ab)E must also within E 1 E1 E1. (another phrase, for every edge ( a → b ) ∈ E (a\to b) \in E (ab)E, if a , b ∈ V 1 a,b \in V1 a,bV1 then this edge must within E 1 E1 E1)
__. It shows that, a Induced-Sub-Graph would only be determined by V 1 V1 V1 (i.e., once V 1 V1 V1 is fixed, then E 1 E1 E1 is unique), so G 1 G1 G1 also be denoted by G [ V 1 ] G[V1] G[V1].
__. e.g., G = ( 1 → 2 ) ( 3 → 4 ) ( 4 → 5 ) ( 6 → 7 ) G = (1\to 2) (3\to 4) (4\to 5) (6\to 7) G=(12)(34)(45)(67), the sub-graph ( 1 → 2 ) ( 3 → 4 ) (1\to 2) (3\to 4) (12)(34) is Induced-Sub-Graph (and also for ( 3 ) ( 5 ) (3) (5) (3)(5)), while ( 1 ) ( 2 ) (1) (2) (1)(2) is not.
__. Any two ISG may contain the same points; e.g., G = ( a → c ) ( b → c ) G = (a\to c) (b\to c) G=(ac)(bc), then G [ { a , b } ] G[ \{a,b\}] G[{a,b}] and G [ { b , c } ] G[ \{b,c\}] G[{b,c}] are both ISG;


A Closed-Sub-Graph (闭合子图) G 1 = ( V 1 , E 1 ) G1 = (V1, E1) G1=(V1,E1) is a Induced-Sub-Graph of G = ( V , E ) G = (V, E) G=(V,E) such that for every edge ( v 1 → x )   o r   ( x → v 1 ) ∈ E (v1 \to x) \ or \ (x \to v1) \in E (v1x) or (xv1)E where v 1 ∈ V 1 v1 \in V1 v1V1, satisfying x ∈ V 1 x \in V1 xV1.

. e.g., G = ( 1 → 2 ) ( 3 → 4 ) ( 4 → 5 ) ( 6 → 7 ) G = (1\to 2) (3\to 4) (4\to 5) (6\to 7) G=(12)(34)(45)(67), the sub-graph ( 1 → 2 ) ( 3 → 4 ) ( 4 → 5 ) (1\to 2) (3\to 4) (4\to 5) (12)(34)(45) is Closed-Sub-Graph, while ( 3 → 4 ) (3\to 4) (34) is not.


A Path (路径) ( V , E ) (V, E) (V,E) where V V V is a sequence of points and E E E is a sequence of edges, such that ∣ V ∣ = ∣ E ∣ − 1 ≥ 1 |V| = |E| - 1 \geq 1 V=E11 and e i = ( v i → v i + 1 ) e_i = (v_i \to v_{i+1}) ei=(vivi+1);
+ ( { a } , { } ) ( \{a\}, \{\}) ({a},{}) which just contains one-point, is also a Path;


A Trail (迹) is a Path such that e 1 , e 2 , . . . , e k e1, e2, ..., ek e1,e2,...,ek are pairwise distinct.


A Simple-Path (简单路径) is a Path whose v 1 , v 2 , . . . , v k , v k + 1 v1, v2, ..., vk, v_{k+1} v1,v2,...,vk,vk+1 are pairwise distinct.


A Circuit (回路) is a Trail (not Path) whose v 1 = v k + 1 v1 = v_{k+1} v1=vk+1
+ A Loop is also a Circuit.


A Simple-Circuit (简单回路) is a Circuit such that v 2 , . . . , v k v2, ..., vk v2,...,vk are pairwise distinct.


A Loop (自环) is a edge whose Head is the same as Tail (i.e., a → a a \to a aa)


A edge is called Multiple-Edge (重边) ( a → b a \to b ab), if there exists another edge which is also in the form a → b a \to b ab


A graph is called Simple-Graph (简单图) if it has no Loop and Multiple-Edge


A directed-edge a → b a \to b ab where a a a is called Tail (起点) (source-point) and b b b is Head (终点) (destiny-point)


The Out-Degree (出度) of a point a a a denoted d o u t ( a ) dout(a) dout(a) is the edges-count whose Tail is a a a (i.e., the form a → ? a \to ? a?)

The In-Degree (入度) of a point a a a denoted d i n ( a ) din(a) din(a) is the edges-count whose Head is a a a (i.e., the form ? → a ? \to a ?a)

A property: ∑ v ∈ V d o u t ( v ) = ∑ v ∈ V d i n ( v ) = ∣ E ∣ \sum_{v \in V} dout(v) = \sum_{v \in V} din(v) = |E| vVdout(v)=vVdin(v)=E

无向图UnG

二分图BipartiteGraph

Terms: 最大匹配, 最小点覆盖, 最大独立集

Detailed-Contents-Link

点割集,割点,K点连通,点连通度

A Vertex-Cut (点割集) (or Separating-Set) of connected-graph G G G is a set of vertices whose removal makes G G G disconnected; (removal means deleting these points and its Adjacent-Edges)
__. If you define on a undirected-graph, and the term disconnected means that making the number of Connected-Component greater; this has some ambiguity, e.g., ( a − b ) ( b − c ) ( d ) (a-b) (b-c) (d) (ab)(bc)(d), then Is the set b , d b, d b,d a Vertex-Cut? (the number of CC is always equals 2 2 2 before or after the Vertex-Cut); so we talk about the Vertex-Cut when G G G is connected.
+ G = ( a − b ) ( b − c ) ( a − d ) ( d − c ) G=(a-b) (b-c) (a-d) (d-c) G=(ab)(bc)(ad)(dc) where ( b , d ) (b,d) (b,d) is a Vertex-Cut;
+ A connected-graph consists of ≤ 2 \leq 2 2 vertex would never be disconnected, so a graph maybe not exists a Vertex-Cut, (e.g., ( a − b ) (a-b) (ab) has not Vertex-Cut), and moreover, the size of any Vertex-Cut is always [ 1 , ∣ V ∣ − 2 ] [1, |V| - 2] [1,V2];
__. Property: if there is a Vertex-Cut whose size is x x x, then there must exist Vertex-Cuts whose size are [ x + 1 , x + 2 , . . . , ∣ V ∣ − 2 ] [x+1, x+2, ..., |V| - 2] [x+1,x+2,...,V2]
+ A Vertex-Cut with size 1 1 1 (i.e., { a } \{ a \} {a}), where a a a is also called Cut-Point (割点)
__. distinguish the notions (a graph has multiple Cut-Point) between (a Vertex-Cut consists of multiple points)

Cuz a graph may not has a Vertex-Cut, we introduce a notion of K-Vertex-Connected;
A connected-graph is said K-Vertex-Connected if G G G does not contain any Vertex-Cut whose size is K − 1 K - 1 K1; (stipulation, K ∈ [ 0 , ∣ V ∣ − 1 ] K \in [0, |V| - 1] K[0,V1]) (e.g., ( a − b ) ( a − c ) ( b − d ) ( c − d ) (a-b) (a-c) (b-d) (c-d) (ab)(ac)(bd)(cd), ∣ V ∣ = 4 |V| = 4 V=4 so K ∈ [ 2 , 3 ] K \in [2, 3] K[2,3] there are Vertex-Cuts { b , c } , { a , d } \{ b, c \}, \{ a, d\} {b,c},{a,d}, so G G G is called 3-Vertex-Connected.
+ If a graph is K-Vertex-Connected (K点连通的), then it is also [ 0 , 1 , 2 , 3 , . . . , K ] [0,1,2,3,..., K] [0,1,2,3,...,K]-Vertex-Connected, from the property of Vertex-Cut mentioned above. In other words, for the range [ 0 , . . . , ∣ V ∣ − 1 ] [0, ..., |V| - 1] [0,...,V1] and there always (e.g., i = 0 i=0 i=0) exists a number i i i in this range where [ l , . . . , i ] [l, ..., i] [l,...,i] are True and [ i + 1 , . . . , r ] [i+1, ..., r] [i+1,...,r] are False (it has the property of Dichotomy); that is, the graph is said to be K K K-Vertex-Connected for any number K ∈ [ l , . . . , i ] K \in [l, ..., i] K[l,...,i]. The Vertex-Connectivity (点连通度) of G G G is the number i i i.
+ A connected-graph is K-Vertex-Connected where K K K maybe not unique (discussed above), not implies that G G G has a Vertex-Cut whose size if K − 1 K-1 K1, even it has no Vertex-Cut (e.g., a Complete-Graph has no Vertex-Cut).
__. More precisely, ( G G G is Complete-Graph ⇔ \Leftrightarrow the Vertex-Connectivity of G G G is ∣ V ∣ − 1 |V| -1 V1); in this case ( G G G is Complete-Graph), it has no Vertex-Cut; otherwise (once G G G is not Complete-Graph), ( G G G is not Complete-Graph ⇔ \Leftrightarrow the Vertex-Connectivity of G G G is the minimal-size of all its Vertex-Cuts)

边割集,割边/桥,K边连通,边连通度

Similar the above notions of Vertex-Cut, Cut-Point, K-Vertex-Connected, Vertex-Connectivity which are based on Vertices, there are Edge-Cut, Bridge, K-Edge-Connected, Edge-Connectivity which are based on Edges.

A Edge-Cut (边割集) of connected-graph G G G is a set of edges whose removal makes G G G disconnected; (removal means deleting these edges)
+ A Edge-Cut with size 1 1 1 (i.e., { a } \{ a \} {a}), where a a a is also called Bridge (Cut-Point) (桥/割边)

A co-graph is called K-Edge-Connected such that there is not a Edge-Cut whose size if K − 1 K - 1 K1.
+ for the range [ 0 , . . . , ∣ E ∣ ] [0, ..., |E|] [0,...,E], there must exist a i i i where [ 0 , i ] [0, i] [0,i] are True and [ i + 1 , ∣ E ∣ ] [i+1, |E|] [i+1,E] are False (i.e., G is call K K K-Edge-Connected where K K K must ∈ [ 0 , i ] \in [0, i] [0,i]), the Edge-Connectivity (边连通度) of G equals i i i.
+ a connected-graph G G G whose Edge-Connectivity is K K K shows that there must has a Edge-Cut whose size is K K K (if ∣ E ∣ > 0 |E| > 0 E>0), also the minimal-size of all Edge-Cut is K K K. (cuz, if ∣ E ∣ > 0 |E| > 0 E>0 then we can let the Edge-Cut be E E E, G must be disconnected, which differs from the case of Vertex-Cut)

--

In summary, A co-graph whose Vertex-Connectivity is K K K shows that either there is a minimal Vertex-Cut whose size is K K K (if G is not Complete-Graph), or there is no Vertex-Cut (G is Complete-Graph)
A co-graph whose Edge-Connectivity is K K K shows that either there is a minimal Edge-Cut whose size is K K K (if ∣ E ∣ > 0 |E| > 0 E>0), or there is no Edge-Cut (if ∣ E ∣ = 0 |E| = 0 E=0)

点双连通分量,边双连通分量 @NeedFinish( removed to the next)

A connected-graph is called Point-Biconnected (biconnected) (点双连通的) that is nearly the same as 2-Vertex-Connected (K点连通) except for the case ∣ V ∣ ≤ 2 |V| \leq 2 V2 which is not 2-Vertex-Connected but Point-Biconnected;
__. a same situation for Edge-Biconnected (边双连通的);
More precisely (or a formal definition), a connected-graph is Point-Biconnected if and only if it has no Cut-Point; a connected-graph is Edge-Biconnected if and only if it has no Cut-Edge

More precisely, Point-Biconnected-Component (点的双连通分量) (PBCC) G 1 G1 G1 is a Sub-Graph of G G G such that G 1 G1 G1 has no Cut-Point and there is no G 2 G2 G2 satisfying without Cut-Point and G 1 ⊂ G 2 G1 \subset G2 G1G2.

Also, Edge-Biconnected-Component (边的双连通分量) (EBCC) G 1 G1 G1 is a Sub-Graph of G G G such that G 1 G1 G1 has no Cut-Edge and there is no G 2 G2 G2 satisfying without Cut-Edge and G 1 ⊂ G 2 G1 \subset G2 G1G2.

Two points a , b a,b a,b are called Point-Biconnected if there has at least two paths a → S 1 → b a \to S1 \to b aS1b and a → S 2 → b a \to S2 \to b aS2b where S i Si Si is the set of points on the path except the endpoints a , b a,b a,b, such that S 1 ∧ S 2 = ∅ S1 \land S2 = \empty S1S2=;
__. (of course, the premise is a , b a,b a,b must be connected so that there has path between a , b a,b a,b; a , a a,a a,a (maybe no loop on it) are always PB; an edge a − b a-b ab shows that a , b a,b a,b are always PB; due to ∅ ∧ ∅ = ∅ \empty \land \empty = \empty =)
+ In a PBCC of G G G, any two points are Point-Biconnected; (if not, there is a point c c c such that all paths a → b a \to b ab must passes it, then c c c is a Cut-Point, which contradicts that a PBCC has no Cut-Point); in other words, for a P B C C PBCC PBCC, after remove any one point (and its adjacent-edges), this P B C C PBCC PBCC would still be connected;

Two points a , b a,b a,b are called Edge-Biconnected if there has at least two paths a   S 1   b a \ S1 \ b a S1 b and a   S 2   b a \ S2 \ b a S2 b where S i Si Si is the set of edges on the path, such that S 1 ∧ S 2 = ∅ S1 \land S2 = \empty S1S2=;
__. note that, though EB focuses on the Edge-Check, the term EB is acted on two points not two edges, i.e., a , b a,b a,b are EB where a , b a,b a,b must be points)
__. (of course, the premise is a , b a,b a,b must be connected so that there has path between a , b a,b a,b; a , a a,a a,a (maybe no loop on it) are always EB; due to ∅ ∧ ∅ = ∅ \empty \land \empty = \empty =)
+ In a EBCC of G G G, any two points are Edge-Biconnected; (if not, there is a edge c c c such that all paths a → b a \to b ab must passes it, then c c c is a Cut-Edge, which contradicts that a EBCC has no Cut-Edge)

--

Every EBCC and PBCC of a graph, is also a Induced-Sub-Graph. (In fact, all Connected-Component with different types are ISG, due to the requirement of Maximal-Sub-Graph; or you can think in this way that for a CC, we add a new edge between a , b ∈ C C a,b \in CC a,bCC, which would not affect the connectivity of that CC)

--

The EBCCs of a [unconnected] graph G G G are unique and possesses some properties which resemble to SCC; (e.g., G = ( a − b ) ( b − c ) ( c − d ) ( d − b ) ( e ) G = (a-b) (b-c) (c-d) (d-b) (e) G=(ab)(bc)(cd)(db)(e), all EBCCs are [ { a } ] , [ { b , c , d } ] , [ { e } ] [\{a\}], [\{b,c,d\}], [\{e\}] [{a}],[{b,c,d}],[{e}] where [ ] [] [] denotes Induced-Sub-Graph.
+ There has no point whose degree is 1 1 1 in a E B C C EBCC EBCC;
__. Even the degree of all points are > 1 > 1 >1, it also maybe E B C C EBCC EBCC; (e.g., ( a − b ) ( b − c ) ( c − a ) ( b − d ) ( d − e ) ( e − f ) ( f − d ) (a-b) (b-c) (c-a) (b-d) (d-e) (e-f) (f-d) (ab)(bc)(ca)(bd)(de)(ef)(fd))
+ Every point must belongs to one E B C C i EBCCi EBCCi; (so we can distinguish every EBCC by its points)
+ Every edge e e e either belongs to one E B C C i EBCCi EBCCi, or not contained by any EBCC which implies that e e e is a Cut-Edge. (all Cut-Edges join two distinct EBCCs; the number of edges that joins two distinct EBCC must ≤ 1 \leq 1 1, otherwise these edges are not Cut-Edge)
+ If we Shrinking-EBCC for G G G then it would forms a Tree (forest) T T T; cuz any two EBCCs has at most one path due to all edges in T T T are Cut-Edges; in other words, a graph whose all edges are Cut-Edges, then this graph is a Forest.
__. there are some properties: (all edges are the Cut-Edges of G G G and T T T simultaneously) (at most one edge between two points in T T T)
+ All C C CC CC of the remaining graph G 1 G1 G1 whose all Cut-Edges were removed, are all E B C C EBCC EBCCs of G G G
+ The intersection of edges and points between two E B C C EBCC EBCCs are both empty.

--

The PBCCs of a (unconnected) graph G G G are unique and possess some properties which are very strange/unfamiliar differs from the normal type-CC; (e.g., G = ( a − b ) ( b − c ) ( c − d ) ( d − a ) ( a − e ) ( b − f ) ( c − g ) ( c − h ) ( g − h ) ( d − i ) ( d − j ) G = (a-b) (b-c) (c-d) (d-a) (a-e) (b-f) (c-g) (c-h) (g-h) (d-i) (d-j) G=(ab)(bc)(cd)(da)(ae)(bf)(cg)(ch)(gh)(di)(dj), all EBCCs are [ { a , e } ] , [ { b , f } ] , [ { c , g , h } ] , [ { d , i } ] , [ { d , j } ] , [ { a , b , c , d } ] [\{a,e\}], [\{b,f\}], [\{c,g,h\}], [\{d,i\}], [\{d,j\}], [\{a,b,c,d\}] [{a,e}],[{b,f}],[{c,g,h}],[{d,i}],[{d,j}],[{a,b,c,d}] where [ ] [] [] denotes Induced-Sub-Graph.
+ Note that, for a PBCC G 1 G1 G1, the requirement is G 1 G1 G1 has no Cut-Point, do not confused with G 1 G1 G1 not contains any Cut-Point of G G G; these two notions are totally different; e.g., G = ( a − b ) ( b − c ) G = (a-b) (b-c) G=(ab)(bc) where b b b is a Cut-Point of G G G; the PBCCs of G G G are [ { a , b } ] , [ { b , c } ] [\{a,b\}], [\{b,c\}] [{a,b}],[{b,c}] where although b b b is a Cut-Point for G G G, it is not Cut-Point for the PBCC [ { a , b } ] [\{a,b\}] [{a,b}].
__. In other words, do not think that the PBCCs are the CCs of the remaining graph whose all Cut-Points were removed (also its adjacent edges); e.g., G = ( a − b ) ( b − c ) ( c − d ) ( d − a ) ( a − e ) G = (a-b) (b-c) (c-d) (d-a) (a-e) G=(ab)(bc)(cd)(da)(ae) where a a a is the only Cut-Point of G G G, but the remaining graph after deleting a a a is G 1 = ( b − c ) ( c − d ) ( e ) G1 = (b-c) (c-d) (e) G1=(bc)(cd)(e) where the C C [ { b , c , d } ] CC[\{b, c, d\}] CC[{b,c,d}] contains a new Cut-Point c c c and this CC is neither PBCC nor EBCC.
+ Every edge must belongs to one P B C C PBCC PBCC (so we can distinguish every P B C C PBCC PBCC by its edges)
+ Every point a a a either belongs to only one P B C C PBCC PBCC (if and only if a a a is not a Cut-Point of G G G), or belongs to ≥ 2 \geq 2 2 P B C C PBCC PBCCs (if and only if a a a is a Cut-Point of G G G) (e.g., ( a − b ) ( a − c ) ( a − d ) ( a − e ) (a-b) (a-c) (a-d) (a-e) (ab)(ac)(ad)(ae) where a a a belongs to the all 4 4 4 P B C C PBCC PBCCs.)
+ Any P B C C PBCC PBCC must contains ≥ 1 \geq 1 1 Cut-Points (of course, Cut-Points refers to the Cut-Points of G G G; cuz P B C C PBCC PBCC has no Cut-Point)
+ The intersection of edges between two P B C C PBCC PBCCs must be empty;
__. The intersection of points between two P B C C PBCC PBCCs maybe empty, or only one point which must be a Cut-Point of G G G (this differs to the case of E B C C EBCC EBCC which has no intersection whichever for point or edge)
+ P B C C PBCC PBCC can also be Shrunk which is very different to E P C C EPCC EPCC; let all P B C C PBCC PBCCs indexed by [ 1 , . . . , k ] [1,...,k] [1,...,k], for any two P B C C PBCC PBCCs i , j i, j i,j, connect a edge i − j i-j ij if the intersection of points between i , j i,j i,j is not empty (actually, must be just one point), finally (let it be G 1 G1 G1) it is just a connected-graph (maybe not a Tree as usual); every edge of G 1 G1 G1 denotes exactly one Cut-Point (the intersection of two P B C C PBCC PBCC)
__. e.g., G = ( a − b ) ( b − c ) ( b − d ) G=(a-b) (b-c) (b-d) G=(ab)(bc)(bd), after shrunk we get G 1 = ( x − y ) ( y − z ) ( z − x ) G1 = (x-y) (y-z) (z-x) G1=(xy)(yz)(zx) which is not a Tree;
__. e.g., G = ( a − b ) ( b − c ) ( c − d ) G=(a-b) (b-c) (c-d) G=(ab)(bc)(cd), after shrunk we get G 1 = ( x − y ) ( y − z ) G1 = (x-y) (y-z) G1=(xy)(yz) which contains Cut-Point y y y;
__. Therefore, G 1 G1 G1 is just a normal connected-graph, unlike E B C C / S C C EBCC/SCC EBCC/SCC which building the Shrunk-Graph, in P B C C PBCC PBCC, we usually just use the structure vector<int> pbcc[ N] where pbcc[i] = {a1,a2,...} means that the PBCC with id i i i consists of these points {a1,a2,...} (a Cut-Point must belongs to ≥ 2 \geq 2 2 PBCC).
+ If a P B C C PBCC PBCC consists of only one point a a a, then the sole a a a is a C C CC CC of G G G.

--

The properties between PBCC and EBCC:
+ A EBCC maybe not a PBCC; (e.g., ( a − b ) ( a − c ) ( b − c ) ( d − e ) ( d − c ) ( e − c ) (a-b) (a-c) (b-c) (d-e) (d-c) (e-c) (ab)(ac)(bc)(de)(dc)(ec) is a EBCC, while not a PBCC where c c c is Cut-Point); the converse is also satisfied; (e.g., an edge ( a − b ) (a-b) (ab) is a PBCC, while is not a EBCC;) cuz there maybe multiple edges between a , b a,b a,b, edges are distinct not shows the points are distinct.
__. But a PBCC whose ∣ V ∣ ≠ 2 |V| \neq 2 V=2 is always a EBCC; Proof: two paths a − S 1 − b a-S1-b aS1b and a − S 2 − b a-S2-b aS2b where S i Si Si is the set of points in the middle, cuz S 1 ∧ S 2 = ∅ S1 \land S2 = \empty S1S2=, all points in the middle are distinct, thus the edges must be also distinct.
+ The endpoints of a Cut-Edge, maybe not Cut-Point; (e.g., ( a − b ) (a-b) (ab) is a Cut-Edge while a , b a,b a,b are not Cut-Point; a − b − c a-b-c abc where a − b a-b ab is Cut-Edge while a a a is not Cut-Point while b b b is ;
__. More generally, for a Cut-Edge ( a − b ) (a-b) (ab), a a a is Cut-Point if the adjacent-points of a a a is not only b b b; b b b is Cut-Point if the adjacent-points of b b b is not only a a a;
+ All edges of a graph may be all Cut-Edges (e.g., ( a − b ) ( b − c ) ( c − d ) (a-b) (b-c) (c-d) (ab)(bc)(cd);
__. There must exists one point that is not Cut-Point; (all points are Cut-Point is impossible)
+ The maximum of E B C C EBCC EBCCs of graph is ≤ ∣ V ∣ \leq |V| V (from definition) (e.g., all points are isolated);
__. The maximum of P B C C PBCC PBCCs of graph is ≤ ∣ E ∣ \leq |E| E (from definition), and also ≤ ∣ V ∣ \leq |V| V (according to the Shrinking-PBCC Tree. @NeedProof)

PBCC

*PBCC-Leaf* := A PBCC is called a `PBCC-Leaf` if it contains `<= 1` Cut-Point;
*CC* := the Connected-Component of a Undirected-Graph
*Delete(x,y)* :=  delete the point `x` and all its adjacent edges from the graph `y`, return the new graph;
*PBCC-Connected* := If there is a path `a1,a2,...,an` where `ai` is PBCC, such that `ai` intersect with `a_{i+1}`, then two PBCCs `a1, an` is call **PBCC-Connected**;
*Block-Cut-Tree* := @NeedFinish
//--
ASSERT( [the PBCCs of a undirected graph]_<->_[the union of the PBCCs of all its *CC*]);
G := a Connected-Undirected-Graph
ASSERT( every edge in `G` belongs to exact one PBCC (i.e, the edges of two distinct PBCC has no intersection);
vector cut := all Cut-Points of `G`
ASSERT( cut.size() < pbcc.size() <= G.points_count());
vector< vector> pbcc := the PBCCs of `G` 
//< + `pbcc[i] = {a1,a2,...}` means the PBCC whose `id` is `i` consists of those points `a1,a2,...`;
//  + pbcc.size() is the number of PBCCs of `G1; 
//  + cuz a PBCC is also a Induced-SubGraph so that we can just use all points within in PBCC to specify it, but you should also know that a PBCC also contains all edge between these points within it (i.e., you can say that `a edge is within a PBCC`;
vector cover := `cover[i] = a` means there are `a` PBCCs that contains the point `i`;
ASSERT( `cover[i] >= 2` if `i` is a Cut-Point);
ASSERT( `cover[i] == 1` if `i` is not a Cut-Point);
vector cut_count := `cut_count[i] = a` means there are `a` points which belongs to `pbcc[i]` and belongs to `cut` simultaneously;
ASSERT( [pbcc[i] is *PBCC-Leaf*]_<->_[cut_count[i] == 1]);
leaf_count := the number of PBCCs whose `cut_count` equals `1`;
if( cut.empty()){
    ASSERT( [pbcc.size() == 1]_<->_[pbcc[0] == G]);
    ASSERT( cover[i] == 1);
    ASSERT( [G.points_count >= 2]_->_[*Delete(i,G)* is still connected]);
}
else{
    ASSERT( pbcc.size() >= 2);
    ASSERT( pbcc[i].size() >= 2);
    ASSERT( G.poins_count >= 3]);
    ASSERT( leaf_count >= 2);
    ASSERT( [`i` is not a Cut-Point]_->_[*Delete(i,G)* is still connected]);
    ASSERT( [`i` is a Cut-Point]_->_[*Delete(i,G)* has `cover[i]` *CC*, so no longer connected]);
    ASSERT( max( cover[i]) <= leaf_count);
    ASSERT( let `x` be the intersection of points of two distinct PBCC, then [`x` maybe empty]_or_[`x` is just one Cut-Point]);
    ASSERT( any two PBCCs are *PBCC-Connected*);
    {
        T := the Block-Cut-Tree of `G`
        G1 := *Delete(a,G)* (where `a` is a Cut-Point);
        vector cc_g1 := be the CCs of `G1`;
        ASSERT( `cc_g1.size()` == cover[a]);
        ASSERT( [all Block-Cut-Trees of `cc_g1`]_<->_[all Sub-Trees rooted by `a` in `T`]
    }
}

EBCC

基础概念

Two points a , b a,b a,b are called Connected (连通的) if there exists a Path a − . . . − b a-...-b a...b (also Bidirectional-Reachable, i.e., a a a is Reachable for b b b, and b b b is also Reachable for a a a)

. As a lemma, any point is Connected with itself;

G is a Connected-Graph (连通图) if any two points are Connected.


A Connected-Sub-Graph (连通子图) G 1 = ( V 1 , E 1 ) G1 = (V1, E1) G1=(V1,E1) is connected ( a , b a,b a,b is connected ∀ a , b ∈ V 1 \forall a,b \in V1 a,bV1) and G 1 ⊂ G G1 \subset G G1G

. e.g., G = ( 1 − 2 ) ( 2 − 3 ) ( 1 − 3 ) ( 4 ) G = (1-2) (2-3) (1-3) (4) G=(12)(23)(13)(4), then ( 1 − 2 ) ( 2 − 3 ) (1-2) (2-3) (12)(23) is Connected-Sub-Graph (which is not a Induced-Sub-Graph, let alone a Closed-Sub-Graph), while ( 1 − 2 ) ( 4 ) (1-2) (4) (12)(4) is not.


A Connected-Component (连通分量/连通块/极大连通子图) G 1 G1 G1 is a Connected-Sub-Graph of G G G such that there not exists another Connected-Sub-Graph G 2 G2 G2 satisfying G 1 ⊂ G 2 G1 \subset G2 G1G2 (i.e., Connected-Component is a maximal connected sub-graph).

These CC (Connected-Component) for any Graph are unique; suppose G G G could be divided into C C 1 , . . . . C C k CC1, .... CCk CC1,....CCk, there are some properties:
+ Every point and edge must belongs to exact one C C i CCi CCi.
+ k k k is called the number of CC of a graph.
+ A Connected-Component is also a Closed-Sub-Graph, but the converse is not (cuz a Closed-Sub-Graph maybe not Connected, e.g., G = ( a − b ) ( c − d ) G = (a-b) (c-d) G=(ab)(cd) and G G G is also a Closed-Sub-Graph, while it is not connected)
+ For instance, G = ( 1 − 2 ) ( 2 − 3 ) ( 1 − 3 ) ( 4 ) G = (1-2) (2-3) (1-3) (4) G=(12)(23)(13)(4), then ( 1 − 2 ) ( 2 − 3 ) ( 1 − 3 ) (1-2) (2-3) (1-3) (12)(23)(13) is Connected-Component (which is also a Closed-Sub-Graph), while ( 1 − 2 ) ( 2 − 3 ) (1-2) (2-3) (12)(23) is not.


A Sub-Graph (子图) G 1 = ( V 1 , E 1 ) G1 = (V1, E1) G1=(V1,E1) of G = ( V , E ) G = (V,E) G=(V,E) denoted G 1 ∈ G G1 \in G G1G and satisfying that V 1 ∈ V , E 1 ∈ E V1 \in V, E1 \in E V1V,E1E.

. A sub-graph may be somewhat strange, e.g., V 1 V1 V1 is empty-set and E 1 E1 E1 is not empty.


A Spanning-Sub-Graph (生成子图) G 1 = ( V 1 , E 1 ) G1 = (V1, E1) G1=(V1,E1) is a Sub-Graph of G = ( V , E ) G = (V, E) G=(V,E) such that V 1 = V V1 = V V1=V.


A Induced-Sub-Graph (导出子图) G 1 = ( V 1 , E 1 ) G1 = (V1, E1) G1=(V1,E1) is a Sub-Graph of G = ( V , E ) G = (V, E) G=(V,E) such that for every pair points a , b a,b a,b in V 1 V1 V1, any edge ( a − b ) ∈ E (a-b) \in E (ab)E must also within E 1 E1 E1. (another phrase, for every edge ( a − b ) ∈ E (a-b) \in E (ab)E, if a , b ∈ V 1 a,b \in V1 a,bV1 then this edge must within E 1 E1 E1)

. It shows that, a Induced-Sub-Graph would only be determined by V 1 V1 V1 (i.e., once V 1 V1 V1 is fixed, then E 1 E1 E1 is unique), so G 1 G1 G1 also be denoted by G [ V 1 ] G[V1] G[V1].

. e.g., G = ( 1 − 2 ) ( 3 − 4 ) ( 4 − 5 ) ( 6 − 7 ) G = (1-2) (3-4) (4-5) (6-7) G=(12)(34)(45)(67), the sub-graph ( 1 − 2 ) ( 3 − 4 ) (1-2) (3-4) (12)(34) is Induced-Sub-Graph (and also for ( 3 ) ( 5 ) (3) (5) (3)(5)), while ( 1 ) ( 2 ) (1) (2) (1)(2) is not.


A Closed-Sub-Graph (闭合子图) G 1 = ( V 1 , E 1 ) G1 = (V1, E1) G1=(V1,E1) is a Induced-Sub-Graph of G = ( V , E ) G = (V, E) G=(V,E) such that for every edge ( v 1 , x ) ∈ E (v1, x) \in E (v1,x)E where v 1 ∈ V 1 v1 \in V1 v1V1, satisfying x ∈ V 1 x \in V1 xV1.

. e.g., G = ( 1 − 2 ) ( 3 − 4 ) ( 4 − 5 ) ( 6 − 7 ) G = (1-2) (3-4) (4-5) (6-7) G=(12)(34)(45)(67), the sub-graph ( 1 − 2 ) ( 3 − 4 ) ( 4 − 5 ) (1-2) (3-4) (4-5) (12)(34)(45) is Closed-Sub-Graph, while ( 1 − 2 ) ( 3 − 4 ) (1-2) (3-4) (12)(34) is not.

A Path (路径) is a sequence of edges (imagine that you’re traversing along the graph from a source-point) e 1 , e 2 , . . . , e k e1, e2, ..., ek e1,e2,...,ek such that there exists a sequence of points v 1 , v 2 , . . . , v k , v k + 1 v1, v2, ..., vk, v_{k+1} v1,v2,...,vk,vk+1 and the endpoints of e i ei ei is v i , v i + 1 vi, v_{i+1} vi,vi+1


A Trail (迹) is a Path such that e 1 , e 2 , . . . , e k e1, e2, ..., ek e1,e2,...,ek are pairwise distinct.


A Simple-Path (简单路径) is a Path whose points v 1 , v 2 , . . . , v k , v k + 1 v1, v2, ..., vk, v_{k+1} v1,v2,...,vk,vk+1 are pairwise distinct.


A Circuit (回路) is a Trail (not Path) whose v 1 = v k + 1 v1 = v_{k+1} v1=vk+1

. A Loop is also a Circuit.


A Simple-Circuit (简单回路) is a Circuit such that v 2 , . . . , v k v2, ..., vk v2,...,vk are pairwise distinct.


A Loop (自环) is a edge whose endpoints a , b a,b a,b are the same (i.e., a = b a = b a=b)


A edge is Multiple-Edge (重边) (its endpoints a , b a,b a,b) if there exists another edge whose endpoints are also also a , b a,b a,b


A graph is called Simple-Graph (简单图) if it has no Loop and Multiple-Edge


The Degree (度数) of a point a a a denoted d ( a ) d(a) d(a) is the edges-count whose one (or two) endpoint is a a a;

For every edge a − b a-b ab, it will cause d(a)+=1, d(b)+=1 (i.e., one edge always contributes two on the array d ( ) d() d() )
. As a lemma from this property, we have ∑ v   i n V d ( v ) = 2 ∗ ∣ E ∣ \sum_{v \ in V} d(v) = 2 * |E| v inVd(v)=2E (图论基本定理, 握手定理)
. . As a lemma for the above, the number of points whose d ( x ) d(x) d(x) is Odd, is always an Even number;

If the graph is Simple (i.e., no self-edge, no multiple-edges), then we have d ( a ) = ∣ N ( a ) ∣ d(a) = |N(a)| d(a)=N(a)


If d ( x ) = 0 d(x) = 0 d(x)=0, then x x x is called Isolated-Point;
If d ( x ) = 1 d(x) = 1 d(x)=1, then x x x is called Leaf-Point;


A graph is called K-Regular-Graph (正则图) is d ( v ) = K ∀ v ∈ V d(v) = K \quad \forall v \in V d(v)=KvV


Two points a , b a, b a,b are called Adjacent (相邻) if there exists an edge a − b a-b ab


The Neighborhood (邻域) of a point a a a denoted N ( a ) N(a) N(a), is the set of all Adjacent-points of a a a (i.e., the set of points x x x such that there exists an edge a − x a-x ax)

Redirect-ID 1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值