当前位置: 首页 > news >正文

win2003怎么做网站建网站需要哪些步骤

win2003怎么做网站,建网站需要哪些步骤,简单网站首页怎么做,企业简介画册way&#xff1a;找入度为0的节点删除&#xff0c;减少其他节点的入度&#xff0c;继续找入度为0的节点&#xff0c;直到删除完所有的图节点。&#xff08;遍历node的neighbors就能得到neighbors的入度信息&#xff09; #include<iostream> #include<vector> #incl…

 way:找入度为0的节点删除,减少其他节点的入度,继续找入度为0的节点,直到删除完所有的图节点。(遍历node的neighbors就能得到neighbors的入度信息)

#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<queue>
using namespace std;//边结构的描述
class Edge
{
public://边的起始节点Node *from;//边的终点节点Node *to;//边的权重int weight;
public:Edge(Node *from, Node *to, int weight){this->from = from;this->to = to;this->weight = weight;}
};//点结构的描述
class Node
{
public://编号值int value;//入度int in;//出度int out;//邻接的点vector<Node*> nexts;//邻接的边vector<Edge*> edges;
public:Node(){}Node(int value){this->value = value;in = 0;out = 0;}
};//图结构的描述
class Graph
{
public:map<int, Node*> nodes;set<Edge*> edges;Graph(){}
};//利用边结构描述的图来构建图结构
//[0,7,5]   [from,to,weight]
//[0,1,3]   [from,to,weight]
Graph* createGraph(vector<vector<int>> matrix)
{Graph *graph = new Graph();int m = matrix.size();for(int i=0; i<m; i++){int from = matrix[i][0];int to = matrix[i][1];int weight = matrix[i][2];//将起点结构放到图里面if(!graph->nodes.count(from)){Node *fromNode =new Node(from);graph->nodes[from] = fromNode;}//将终点结构放到图里面if(!graph->nodes.count(to)){Node *toNode=new Node(to);graph->nodes[to] = toNode;}//将起点和终点的边结构也放到图里面(点可能已经存在过,边一定是新的)Node *fromNode = graph->nodes[from];Node *toNode = graph->nodes[to];Edge *newEdge = new Edge(fromNode, toNode, weight);fromNode->nexts.push_back(toNode);fromNode->edges.push_back(newEdge);fromNode->out++;toNode->in++;graph->edges.insert(newEdge);}return graph;
}vector<Node*> topSort(Graph *graph)
{//收集节点入度映射,将0入度放入que中map<Node*,int>indegreeMap;queue<Node*>zeroQue;for(auto pa:graph->nodes){indegreeMap[pa.second]=pa.second->in;if(indegreeMap[pa.second]==0){zeroQue.push(pa.second);}}vector<Node*>result;//开始按入度为0删除节点,同时减少其他节点入度,删除入度为0...while(!zeroQue.empty()){Node *cur=zeroQue.front();zeroQue.pop();result.push_back(cur);for(auto next: cur->nexts){indegreeMap[next]=indegreeMap[next]-1;if(indegreeMap[next]==0){zeroQue.push(next);}}}return result;
}

http://www.hkea.cn/news/410065/

相关文章:

  • 如何做微信ppt模板下载网站企业网页设计公司
  • 做b2b网站百度点击快速排名
  • 网站怎么做移动图片不显示不出来吗芭嘞seo
  • 旅游网站建设服务器ip域名解析
  • 企业网站建设三个原则百度指数资讯指数是指什么
  • 房地产集团网站建设方案软文文案案例
  • 阜蒙县建设学校网站是什么北京seo编辑
  • 珠海建设局网站十大经典事件营销案例分析
  • 创建网站开发公司互联网推广引流是做什么的
  • 万盛集团网站建设seo网站推广全程实例
  • 做教育的网站需要资质吗网站怎么开发
  • 微网站怎么做滚动中国万网域名注册官网
  • 个人如何免费建网站seo在线优化工具 si
  • 双线主机可以做彩票网站吗网络推广合作协议
  • 做外贸的b2b网站域名批量查询系统
  • 建设网站需要哪些职位网站建设策划书
  • 苏州网站建设哪里好网站点击排名优化
  • 网站建设收费标准策划百度推广关键词越多越好吗
  • 网站怎么做更新吗如何建立网页
  • 国外建设工程招聘信息网站tool站长工具
  • 专业做相册书的网站电商网站建设制作
  • 银川网站开发公司电话东莞网
  • 环境保护局网站管理制度建设百度指数的主要功能有
  • 安装wordpress提示500错误关键词优化的策略有哪些
  • 企业网站建设公司排名深圳高端seo公司助力企业
  • 做网站套餐网站seo
  • 网站上的代码网页怎么做的下载百度软件
  • 网站功能模块建设搜狗推广
  • 网站做推广有用吗网站页面设计
  • 做简报的网站广州搜发网络科技有限公司