#include "graph.c"无法找到原文件怎么办

weixin_42163912 weixin_42163912 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
想用VS2017运行基本遗传算法源程序时报错,求大神帮助解决一下

# include <stdio.h>
# include <graphics.h>
# include <math.h>
# include "graph.c"
struct individual
{
unsigned * chrom;
double fitness;
double varible;
int xsite;
int parent[2];
int * utility;
};
struct bestever
{
unsigned * chrom;
double fitness;
double varible;
int generation;
};
struct individual * oldpop;
struct individual * newpop;
struct bestever bestfit;
double sumfitness;
double max;
double avg;
double min;
float pcross;
float pmutation;
int popsize;
int lchrom;
int chromsize;
int gen;
int maxgen;
int run;
int maxruns;
int printstrings;
int nmutation;
int ncross;
static double oldrand[55];
static int jrand;
static double mdx2;
static int mdcalcflag;

FILE * outfp;
void advance_random();
int flip(float); rnd(int, int);
void randomize();
double randomnormaldeviate();
float randomperc(), rndreal(float, float);
void warmup_random(float);
void initialize(), initdata(), initpop();
void initreport(), generation(), initmalloc();
void freeall(), nomernory(char *), report();
void writepop(), writechrom(unsigned *);
void preselect();
void statistics(struct individual *);
void title(), repchar(FILE *, char *, int);
void skip(FILE *, int);
int select();
void objtunc(struct individual *);
int crossover(unsigned *, unsigned *, unsigned *, unsigned *);
void mutation(unsigned *);
...全文

相关推荐

CCS3.3里面,使用View -Graph-Image显示图片 DSP图片显示

CCS3.3里面,使用View -Graph-Image显示图片 DSP图片显示。自己试验,配图显示过程,希望能帮助你!

Kuanhuai_Luo

graph-assembler

图汇编器 一个非常简单的C工具,可以从包含您的数据点的.txt文件创建线形图。 目录 2.2。 面积图 0.目的 0.1。 这是为了什么? 这是一些方案 您有一个C / C ++程序,需要定期在.txt文件中获取一些数据,并且需要制作一个简单的图形。 您需要节省时间:多次获取数据并复制到excel令人沮丧。 您需要对数标度。 您需要一个Shell工具来制作图形。 0.2。 这不是为了什么? 您需要饼图。 您需要实时更新图形。 1.用法 1.1分5步合并到您的程序中 请参阅第2节,了解如何格式化数据文件 将此文件夹复制到您的项目文件夹。 包括头文件assemble.h : #include "graph-assembler/assemble.h" 编译时,添加源assemble.c ,例如: clang myProgram.c graph-assembler

Yuan Andy

C语言寻找无向图两点间的最短路径

主要为大家详细介绍了C语言寻找无向图两点间的最短路径,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

weixin_38706951

c_数据结构_图的相关操作

数据结构中图的相关操作 C语言 #include &lt;stdio h&gt; #include &lt;malloc h&gt; #include &lt;string h&gt; #define MAXVEX 100 typedef char VertexType[3]; 定义VertexType为char数组类型 typedef struct vertex { int adjvex; 顶点编号 VertexType data; 顶点的信息 } VType; 顶点类型 typedef struct graph { int n e; n为实际顶点数 e为实际边数 VType vexs[MAXVEX]; 顶点集合 int edges[MAXVEX][MAXVEX]; 边的集合 } AdjMatix; 图的邻接矩阵类型 typedef struct edgenode { int adjvex; 邻接点序号 int value; 边的权值 struct edgenode next; 下一条边的顶点 } ArcNode; 每个顶点建立的单链表中结点的类型 typedef struct vexnode { VertexType data; 结点信息 ArcNode firstarc; 指向第一条边结点 } VHeadNode; 单链表的头结点类型 typedef struct { int n e; n为实际顶点数 e为实际边数 VHeadNode adjlist[MAXVEX]; 单链表头结点数组 } AdjList; 图的邻接表类型 int visited[MAXVEX]; void DispAdjList AdjList G { int i; int in[G &gt;n] out[G &gt;n]; for i 0;i&lt;G &gt;n;i++ {in[i] 0 out[i] 0; } ArcNode p; printf &quot;图的邻接表表示如下: n&quot; ; for i 0;i&lt;G &gt;n;i++ { printf &quot; 结点 [%d %3s] &gt;&quot; i G &gt;adjlist[i] data ; p G &gt;adjlist[i] firstarc; while p NULL { out[i]++; 对于结点的出度加1 in[p &gt;adjvex] ++; 邻接表中的结点的序号所在的结点的入度 加1 printf &quot; %d &gt;&quot; p &gt;adjvex ; p p &gt;next; } printf &quot;∧ n&quot; ; } for i 0;i&lt;G &gt;n;i++ { printf &quot; 结点 [%d %3s]的度 :%d n&quot; i G &gt;adjlist[i] data in[i]+out[i] ; } } void MatToList AdjMatix g AdjList &amp;G 算法:将邻接矩阵g转换成邻接表G { int i j; ArcNode p; G AdjList malloc sizeof AdjList ; for i 0;i&lt;g n;i++ 给邻接表中所有头结点的指针域置初值 { G &gt;adjlist[i] firstarc NULL; strcpy G &gt;adjlist[i] data g vexs[i] data ; } for i 0;i&lt;g n;i++ 检查邻接矩阵中每个元素 for j g n 1;j&gt; 0;j if g edges[i][j] 0 邻接矩阵的当前元素不为0 { p ArcNode malloc sizeof ArcNode ; 创建一个结点 p p &gt;value g edges[i][j];p &gt;adjvex j; p &gt;next G &gt;adjlist[i] firstarc; 将 p链到链表后 G &gt;adjlist[i] firstarc p; } G &gt;n g n;G &gt;e g e; } void DFS AdjList g int vi 对邻接表G从顶点vi开始进行深度优先遍历 { ArcNode p; printf &quot;下标%d结点%3s &gt;&quot; vi g &gt;adjlist[vi] data ; 访问vi顶点 visited[vi] 1; 置已访问标识 p g &gt;adjlist[vi] firstarc; 找vi的第一个邻接点 while p NULL 找vi的所有邻接点 { if visited[p &gt;adjvex] 0 DFS g p &gt;adjvex ; 从vi未访问过的邻接点出发深度优先搜索 p p &gt;next; 找vi的下一个邻接点 } } void DFS1 AdjList G int vi 非递归深度优先遍历算法 { ArcNode p; ArcNode St[MAXVEX]; int top 1 v; printf &quot;%d &gt; &quot; vi ; 访问vi顶点 visited[vi] 1; 置已访问标识 top++; 将初始顶点vi的firstarc指针进栈 St[top] G &gt;adjlist[vi] firstarc; while top&gt; 1 栈不空循环 { p St[top];top ; 出栈一个顶点为当前顶点 while p NULL 循环搜索其相邻顶点 { v p &gt;adjvex; 取相邻顶点的编号 if visited[v] 0 若该顶点未访问过 { printf &quot;%d &gt; &quot; v ; 访问v顶点 visited[v] 1; 置访问标识 top++; 将该顶点的第1个相邻顶点进栈 St[top] G &gt;adjlist[v] firstarc; break; 退出当前顶点的搜索 } p p &gt;next; 找下一个相邻顶点 } } } void BFS AdjList G int vi 对邻接表g从顶点vi开始进行广宽优先遍历 { int i v; int Qu[MAXVEX] front 0 rear 0; 循环队列 ArcNode p; printf &quot;%d &gt; &quot; vi ; 访问初始顶点 visited[vi] 1; 置已访问标识 rear rear 1 %MAXVEX; 循环移动队尾指针 Qu[rear] vi; 初始顶点进队 while front rear 队列不为空时循环 { front front+1 % MAXVEX; v Qu[front]; 顶点v出队 p G &gt;adjlist[v] firstarc; 找v的第一个邻接点 while p NULL 找v的所有邻接点 { if visited[p &gt;adjvex] 0 未访问过则访问之 { visited[p &gt;adjvex] 1; 置已访问标识 printf &quot;%d &gt; &quot; p &gt;adjvex ; 访问该点并使之入队列 rear rear+1 % MAXVEX; 循环移动队尾指针 Qu[rear] p &gt;adjvex; 顶点p &gt;adjvex进队 } p p &gt;next; 找v的下一个邻接点 } } } int main { int i j; AdjMatix g; AdjList G; int a[5][5] {{0 1 0 1 0} {1 0 1 0 0} {0 1 0 1 1} {1 0 1 0 1} {0 0 1 1 0}}; char vname[MAXVEX] {&quot;a&quot; &quot;b&quot; &quot;c&quot; &quot;d&quot; &quot;e&quot;}; g n 5;g e 6; 连通图 int a[5][5] {{0 1 0 1 0} {1 0 1 0 0} {0 1 0 1 0} {1 0 1 0 0} {0 0 0 0 0}}; char vname[MAXVEX] {&quot;a&quot; &quot;b&quot; &quot;c&quot; &quot;d&quot; &quot;e&quot;}; g n 5;g e 4; 非连通图 int a[4][4] {{0 1 1 1} {1 0 1 1} {1 1 0 1} {1 1 1 0}}; char vname[MAXVEX] {&quot;a&quot; &quot;b&quot; &quot;c&quot; &quot;d&quot;}; g n 5;g e 12; int a[5][5] {{0 1 1 1 0} {1 0 1 1 1} {1 1 0 1 0} {1 1 1 0 1} {0 1 0 1 0}}; char vname[MAXVEX] {&quot;a&quot; &quot;b&quot; &quot;c&quot; &quot;d&quot; &quot;e&quot;}; g n 5;g e 16; 建立图的无向图 每1条无向边算为2条有向边 int a[6][6] { p151 图7 22的代价矩阵改成的邻接矩阵 {0 1 1 0 1 0} {0 0 1 0 1 0} {1 0 0 1 0 0} {0 1 0 0 1 0} {0 0 0 1 0 0} {0 0 0 1 0 0}}; char vname[MAXVEX] {&quot;v0&quot; &quot;v1&quot; &quot;v2&quot; &quot;v3&quot; &quot;v4&quot; &quot;v5&quot;}; g n 6;g e 11; for i 0;i&lt;g n;i++ strcpy g vexs[i] data vname[i] ; for i 0;i&lt;g n;i++ for j 0;j&lt;g n;j++ g edges[i][j] a[i][j]; MatToList g G ; 生成邻接表 DispAdjList G ; 输出邻接表 for i 0;i&lt;g n;i++ visited[i] 0; 顶点标识置初值 printf &quot;从顶点0的深度优先遍历序列: n&quot; ; printf &quot; 递归算法:&quot; ;DFS G 0 ;printf &quot; n&quot; ; for i 0;i&lt;g n;i++ visited[i] 0; 顶点标识置初值 printf &quot; 非递归算法:&quot; ; DFS1 G 0 ; printf &quot; n&quot; ; printf &quot;从顶点0的广度优先遍历序列: n&quot; ; for i 0;i&lt;g n;i++ visited[i] 0; 顶点标识置初值 printf &quot; t&quot; ;BFS G 0 ; printf &quot; n&quot; ; scanf &quot;%d&quot; ; return 0; }">数据结构中图的相关操作 C语言 #include &lt;stdio h&gt; #include &lt;malloc h&gt; #include &lt;string h&gt; #define MAXVEX 100 typedef char VertexType[3]; 定义VertexType为char数组类型 typedef struct vertex { int adjvex; 顶点编号 VertexType data; 顶 [更多]

qq_25181777

图的遍历#include

#include struct node // * 图形顶点结构宣告 */

weny12
评论 6
收藏 已收藏
分享
返回顶部
weixin_42163912
C语言 70,040 成员 243,237 内容