【机智的图论】牛客2018多校第十场 F. Rikka with Line Graph

博客介绍了如何解决牛客2018多校第十场 F. Rikka with Line Graph 题目,涉及边权重的无向完全图,通过将边转化为点构建新图并计算每对点的最短路径之和。解题思路包括理解边的最短路计算,使用弗洛伊德算法,并枚举边来计算每个点的最短路径贡献。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

【机智的图论】牛客2018多校第十场 F. Rikka with Line Graph

【题目链接】


题目描述

Line Graph L(G) can be considered as an operator on an undirected graph G just like Complementary Graph and Dual Graph.

Rikka generalizes Line Graph to edge-weighted undirected graphs. For a graph G=(V,E) , L(G) is still an edge-weighted undirected graph which is constructed in the following way:
这里写图片描述

  1. L(G) has |E| vertices and the ith vertex corresponds to the ith edge in G.
  2. There is an edge between i,j in L(G) if and only if edge i and j have at least one common vertices in G. And the edge weight is equal to the sum of the weights of edge i and j in G.

For example, in the following picture, the right graph is the line graph of the left one. Vertex 1,2,3,4 in L(G) correspond to edge (1,2),(1,4),(1,3),(3,4) in G. And if all edges in the left graph have weight 1, the edges in the right graph will have weight 2.

Now, Rikka has an edge-weighted undirected complete graph G with n vertices. And she constructs a graph G’=L(G). It is clear that G’ is connected.

Let d(i,j) be the length of the shortest path between vertex i,j in G’(the length of each edge is equal to its weight),

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值