当前位置:网站首页>根据输入画有向图
根据输入画有向图
2022-07-01 06:25:00 【Keep--Silent】
解释
直接根据输入画一个mermaid
源码
#include <bits/stdc++.h>
using namespace std;
int main() {
int m, j,v,w,x;
map<int, map<int, int> >g;
cin >> m;
while (m--) {
cin >> v >> w >> x;
g[v][w] = x;
//g[w][v]=x;
}
set<int>st;
vector<int>t(3, 0);
vector<vector<int>>vt;
for (auto p1:g) {
st.insert(p1.first);
for (auto p2 : p1.second) {
st.insert(p2.first);
vt.push_back(vector<int>{
p1.first,p2.first,p2.second});
}
}
printf("```mermaid\ngraph TD\n");
for (auto x : st) {
printf("%d([%d])\n",x,x);
}
for (auto v : vt) {
printf("\t%d -->|%d| %d\n",v[0],v[2],v[1]);
}
printf("```\n");
return 0;
}
输入输出
7
1 2 2
1 5 1
2 3 1
2 4 1
2 5 2
3 5 1
3 4 1
```mermaid
graph TD
1([1])
2([2])
3([3])
4([4])
5([5])
1 -->|2| 2
1 -->|1| 5
2 -->|1| 3
2 -->|1| 4
2 -->|2| 5
3 -->|1| 4
3 -->|1| 5
```
效果
边栏推荐
- C语言课设图书信息管理系统(大作业)
- Minio error correction code, construction and startup of distributed Minio cluster
- 存储过程学习笔记
- C语言课设学生信息管理系统(大作业)
- 证券类开户有什么影响 开户安全吗
- [unity shader amplify shader editor (ASE) Chapter 9]
- SystemVerilog learning-10-validation quantification and coverage
- 高阶-二叉搜索树详解
- High order binary balanced tree
- VS2019如何永久配置本地OpenCV4.5.5使用
猜你喜欢
![阿里OSS Postman Invalid according to Policy: Policy Condition failed: [“starts-with“, “$key“, “test/“]](/img/3c/7684b7c594f7871471f89007294703.png)
阿里OSS Postman Invalid according to Policy: Policy Condition failed: [“starts-with“, “$key“, “test/“]
![[summary of knowledge points] chi square distribution, t distribution, F distribution](/img/a6/bb5cabbfffb0edc9449c4c251354ae.png)
[summary of knowledge points] chi square distribution, t distribution, F distribution

手把手教你实现一个深度学习框架...

VS2019如何永久配置本地OpenCV4.5.5使用

How did ManageEngine Zhuohao achieve the goal of being selected into Gartner Magic Quadrant for four consecutive years?

SQL语句

Understanding of C manualresetevent class

浅谈SIEM

B-树系列

async 与 await
随机推荐
C how to print out the original array
B-树系列
C语言课设图书信息管理系统(大作业)
【ManageEngine卓豪】移动终端管理解决方案,助力中州航空产业数字化转型
Comment imprimer le tableau original
存储函数学习笔记
[enterprise data security] upgrade backup strategy to ensure enterprise data security
What are the functions of LAN monitoring software
JMM details
子类调用父类的同名方法和属性
Internet worm
地宫取宝(记忆化深搜)
Make: g++: command not found
码力十足学量化|如何在财务报告寻找合适的财务公告
【自动化运维】自动化运维平台有什么用
sci-hub如何使用
数据库对象:视图学习记录
做技术,自信不可或缺
Pychart configuring jupyter
[ITSM] what is ITSM and why does it department need ITSM