代码搜索:Prim
找到约 2,016 项符合「Prim」的源代码
代码结果 2,016
www.eeworm.com/read/276383/10743581
txt prim.txt
#include
#define max 99
void prim(int g[max][max],int k,int n)
{
int i,j,min,p;
struct{
int adjvex;
int lowcost;
}closedge[30];
for(i=1;i
www.eeworm.com/read/274367/10874105
cpp prim.cpp
# include
# define inf 9999
# define max 40
prim(int g[][max],int n)
{
int lowcost[max],closest[max];
int i,j,k,min;
for(i=2;i
www.eeworm.com/read/273093/10927196
m prim.m
function prim(pp)
%PRIM (求最小生成树)
%求最小生成树算法,通过prim算法求最优树,并给出相应图像.
%用法:
% 首先输入矩阵:
% map=[起点1 终点1 边长1;起点2 终点2 边长2;............;起点n 终点n 边长n]
% 再用[out,len]=kruskal(map)求最优树
%参数说明
% map----3列邻接矩
www.eeworm.com/read/272201/10965866
m prim.m
T=[];l=0;%l记录T的列数
q(1)=-1;
for i=2:n
p(i)=1;q(i)=D(i,1);
end
k=1;
while 1
if k>=n
disp(T);
break;
else
min=inf;
for i=2:n
if q(i)>0
www.eeworm.com/read/469495/6929057
h prim.h
//普里姆函数设计
/*通过函数得到的最小生成树的结点数据和相应结点的边的权值数据closeVertex*/
//数据类型定义
typedef struct
{
VerT vertex;
int weight;
}MinSpanTree;
void Prim(AdjMGraph G,MinSpanTree closeVertex[])
{
VerT x
www.eeworm.com/read/469528/6929815
h prim.h
struct MinSpanTree
{
VerT vertex;
int weight;
};
void Prim(AdjMWGraph&G,MinSpanTree minSTree[]);
//
{
int n=G.NumOfVertices(),minCost;
int *lowCost=new int[n];
int i,j,k;
for(i=1;
www.eeworm.com/read/155618/6960696
cpp prim.cpp
/**********************************************
* *
* 求最小生成树的Prim算法 *
* *
* 用邻接矩
www.eeworm.com/read/465191/7059425
cpp prim.cpp
#include
#define MAX 300
struct
{
int x;
int lowcost;
}closedge[MAX];
int getmin(int n) //找出当前边权值最小的点
{
int i,min=999999,vex=-1;
for(i=0;i