K******g 发帖数: 1870 | 1 我选的C,如果被要求写一个graph的拷贝题,要写代码,请问我下面的代码可不可以。
是太简略了呢,还是没有必要这么详细定义结构体,请有经验的人指教。多谢了!
Typedef struct T_vertext
{
Int data;
Int color;
Int d;
LIST *adj;
} VERTEX;
Typedef struct T_list
{
VERTEX* v;
Struct T_list *next;
} LIST;
VERTEX *G1; /*assume it has been already initialized to includes all vertex
in G1*/
VERTEX *G2; //the new graph that is going to be created.
QUEUE q;
For each vertex in G1:
{
Vertex.color = WHITE;
Vertex.d = 0;
}
S = G1.getVertex(0);
Enqueue(q, s); |
|
g*****e 发帖数: 282 | 2 good。我写了一些test cases都是对的。
这题还要写code实现的。请问怎么写code判断是否idsjoint效率最高,如果graph用
adjmatrix描述的?
graph还没复习,现在就翻书去。。。
edges= |
|
s*******u 发帖数: 220 | 3 cc150 graph class, problem 4.2,中间用到graph class,以及相关method:
getNodes(),getAdjacent()。不知道是不是标准库里面的,求教。 |
|
l****o 发帖数: 315 | 4 DFS 和 BSF 的都写了,已过OJ
/**
* Definition for undirected graph.
* class UndirectedGraphNode {
* int label;
* ArrayList neighbors;
* UndirectedGraphNode(int x) { label = x; neighbors = new ArrayList<
UndirectedGraphNode>(); }
* };
*/
public class Solution {
public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) {
// Note: The Solution object is instantiated only once and is reused
by each test case.
if (node == null) return null;
Ha... 阅读全帖 |
|
g****9 发帖数: 163 | 5 GNode的定义是这个。adjacencyMatrix 是N*N的matrix,N是Node的个数。比如
int[][] adjacencyMatrix = {{1, 1, 0, 0, 1, 0},{1, 0, 0, 0, 1, 0},{0, 0, 0, 0
, 0, 0},{0, 0, 0, 0, 1, 1},{1, 1, 0, 1, 0, 0},{0, 0, 0, 1, 0, 0}}; 这个
matrix分别有6个node,每个node的value是1,2,3,4,5,6.定义的这个graph class我是
想用来验证关于graph的code的正确不,所以想简单化node 的value,让自动取i+1作为
node的value值。
class GNode {
private int val;
private boolean discovered;
private ArrayList adj;
public GNode (int x) {
val = x;
adj = new ArrayList阅读全帖 |
|
z***u 发帖数: 105 | 6 按层打印一个人social graph上的朋友。每人只打印一次。
social graph表示:
A:B,C,D. //A的朋友是B,C,D
输入格式
4
A:B,C,D
B:A,D,E
C:E,B
A
4表示之后有4行输入,要打印最后一行,A,的朋友。输出结果应该是
B,C,D
E
请教用什么数据结构,如何做? |
|
d******8 发帖数: 2191 | 7 It might be annoying if posting too many graphs. However, TA is cool. MM
might pump according to this.
I was in F**[email protected] recommended by someone(mmz?) and am still holding it.
Going high through $9 and below $7 and back to $8 and now below $7 again, I
was feeling constant frustration.
The graph can be cheering.
ymyd |
|
b*********h 发帖数: 1 | 8 Maybe Manet doesn't know much about graph theory but I guess it's not good
bashing people like that without giving some suggestions or references. I
guess Manet just needs some keyword to google or some good and easy graph
theory book to read.
I'll recommend "The Algorithm Design Manual" by Steven S. Skiena. My
experience is it's very easy to read and covers common problems with real
implementation. The book also has a CDROM with full book text. Check the book
in your library and copy the whole |
|
r*******n 发帖数: 51 | 9 I don't think there is a solution on your problem. Your a is only a upper
bound of the selection for all type 1 nodes. You can always build a connected
graph and a non-connected graph for any a. So you can't judge the connectivity
just based on your a.
not |
|
c****r 发帖数: 185 | 10 Can anyone recommend a graph visualization tool?
I have some graphs in the adjacency matrix format.
I want to manually observe their structures.
Thanks. |
|
w******T 发帖数: 71 | 11 Given a graph cubic planar graph,
to get maximum independent set of it is NP-hard.
Does any body know this problem admits PTAS or not?
If not, what is the lower bound for it.
Thanks a lot. |
|
g****p 发帖数: 94 | 12 Let G = (V, E) be a weighted, directed graph with weight function w : E → {
1, 2, ..., W } for some positive integer W , and assume that no two vertices
have the same shortest-path weights from source vertex s. Now suppose that
we define an unweighted, directed graph G' = (V ∪ V', E') by replacing each
edge (u, v) ∈ E with w(u, v) unit-weight edges in series.
Questions:
1. How many vertices does G' have?
2. Now suppose that we run a breadth-first search on G'. Show that the order
in which vertic |
|
s*******y 发帖数: 558 | 13 请问谁知道有什么好的工具可以visualize adjacency matrix描述的graph。
adjacency matrix里面所有的entry都是binary的。
matlab里面的gplot需要提供节点的coordinates才能plot graph。
有没有可以自动决定layout的工具?
谢谢 |
|
i********g 发帖数: 41 | 14 【 以下文字转载自 Computation 讨论区 】
发信人: iamyaoming (我叫姚明), 信区: Computation
标 题: 请问matlab能不能算一个graph的diameter?
发信站: BBS 未名空间站 (Mon Sep 24 10:44:35 2007)
我的graph非常大,有400K+的nodes,1.4M+的edge。请问matlab有没有什么function,
或者哪儿能下到什么package能够算出它的diameter? |
|
i******7 发帖数: 1 | 15 哪位大侠能推荐几个公开的, 大的 dataset of directed graphs (having more than
10000 nodes)? 随机产生的 或者 真实的 graph 都可以. 谢了先! |
|
t*****k 发帖数: 390 | 16 这个问题是这样的,你可以认为是找longest paths。
对一个图来说,每个edge都有一个weight,我要找一条path,构成他的edge的weight之
和最大...
现在我要从这个 graph中抽出N条paths出来,找这个graph中除去这N条paths后最longe
st 的path |
|
c*********t 发帖数: 2921 | 17 我在用Boost library, 主要是用Boost Graph Library.
发现算法都是在头文件里实现的,比如要用dijkstra算法,
#include
就行了。
可是我想对boost里的算法进行一点改动,满足我特定的要求,比如对某个算法特定的
情况下处理稍微不同。
看了一下头文件,里面用了很多的template,好像也没有看到算法在头文件里是怎么实
现的,可能是调用了一些boost特有的函数,总之,即使是简单的算法,也不太从头文件
里读懂。
问问,Boost里面,算法真的是所有的功能都在头文件里实现的吗? 一个算法就是在一
个头文件里了吗?
如果想改动一下算法,该如何下手呢?有什么参考的?
谢谢! |
|
s***i 发帖数: 49 | 18 How can I give algorithm that checks whether a graph is bipartite (a graph
whose nodes can be divided into two sets N1 and N2, and every edge is
between a member of N1 and N2)?
And since non-bipartite means there must be a cycle of odd length, how can I
check bipartite, and if false, prints a cycle of odd length?
Thanks in advance. |
|
f**n 发帖数: 401 | 19 【 以下文字转载自 Programming 讨论区 】
发信人: fern (宝宝会翻身了), 信区: Programming
标 题: data structure for set of path in a graph
发信站: BBS 未名空间站 (Tue Mar 23 17:33:56 2010, 美东)
Suppose we have a one-directional graph. Define a path as a sequence of
vertices such that from each of its vertices there is an edge to the next
vertex in the sequence. So a path of three vertices would be recorded
somehow as v1->v2->v3.
Now I need to store a set of paths that are different from each other. For
example, path 1 is v1->v2->v |
|
r*****i 发帖数: 70 | 20 Is there any way to export graphs in access?
otherwise iha ve to export table to excel and
then plot graphs in excel,quite inconvenient. |
|
d*j 发帖数: 756 | 21 【 以下文字转载自 SanFrancisco 讨论区 】
发信人: dmj (大马甲), 信区: SanFrancisco
标 题: 码工问: 啥tool 可以很好的显示 svn 的 revision graph?
发信站: BBS 未名空间站 (Thu Jan 3 17:54:17 2013, 美东)
之前一直用 git, gitk 用着真爽。 最近转到svn 下,不知道 linux 下 svn 有啥好
的工具可以显示 revision graph 么? 最好是免费的,看了 smartsvn, 但是好像这
个功能只能试用。
谢谢~~ |
|
N********n 发帖数: 8363 | 22
What's the input? Is it actually a single-linked list that might have
a circle or a graph. If it's a graph, then I need to know the data
structure of the input. |
|
c*********t 发帖数: 2921 | 23 我在用Boost library, 主要是用Boost Graph Library.
发现算法都是在头文件里实现的,比如要用dijkstra算法,
#include
就行了。
可是我想对boost里的算法进行一点改动,满足我特定的要求,比如对某个算法特定的
情况下处理稍微不同。
看了一下头文件,里面用了很多的template,好像也没有看到算法在头文件里是怎么实
现的,可能是调用了一些boost特有的函数,总之,即使是简单的算法,也不太从头文件
里读懂。
问问,Boost里面,算法真的是所有的功能都在头文件里实现的吗? 一个算法就是在一
个头文件里了吗?
如果想改动一下算法,该如何下手呢?有什么参考的?
谢谢! |
|
s***i 发帖数: 49 | 24 How can I give algorithm that checks whether a graph is bipartite (a graph
whose nodes can be divided into two sets N1 and N2, and every edge is
between a member of N1 and N2)?
And since non-bipartite means there must be a cycle of odd length, how can I
check bipartite, and if false, prints a cycle of odd length?
Thanks in advance. |
|
v****s 发帖数: 1112 | 25 需要在jsp 的frontend 里面画graph, 就是几个node和几个edge相连。
查过了google web toolkit, 没有现成的。高手给推荐几个graph layout的library,最好是jsp
或者
javascript, ajax, php的。谢谢! |
|
m********l 发帖数: 791 | 26 graph database的经验可以transfer到其他的NoSQL数据模型吗?
最近有机会做一个graph database的migration project,不知道有了这个经验对以后
跳槽有没有好处
我看neo4j还是有一定用户的,比如很多通信公司都会用,像ATT,TMobile,Huawei啥的 |
|
m********l 发帖数: 791 | 27 二爷 那为什么公司还用graph database呢?还是有些数据就得用graph database处理? |
|
c*****c 发帖数: 564 | 28 最近在分析另一个组正在开发的一个程序,文档还没出来,没有architecture design
,只能慢慢啃。
以前在matlab里用过一个m2html的工具,对matlab写的代码包扫描一下,就能生成call
graph。
现在想找个类似的python工具,可以静态分析 Python package 并产生 call graph,
class hierarchy,UML 之类的工具,一直不成功,最接近的是 pyreverse,但似乎只
能分析单独的文件。
要求支持python2.7。代码需要调用一些软件,还没有license,没法运行做动态分析。
不知版上高手有什么好推荐的? |
|
发帖数: 1 | 29 This is a simplified version of a real problem we encountered.
Your solutions will preferably be implemented in Go. We'll also consider
solutions implemented in Python (or other languages on request), but since
Go can be learned in approximately a day, we really do prefer a solution
written in Go.
We're building a directed graph.
The graph consists of Nodes connected by Edges.
Each Node has an ID (int64).
Each Node keeps track of its outgoing Edges (list of ids).
There might be thousands of outg... 阅读全帖 |
|
发帖数: 1 | 30 最近尝试和朋友在国内搞点小项目,
核心问题是要存n个directed weighted graph,每张图node的数量大约在3k,n初步目标
30k以内
要支持基本的操作,比如topological sort等常见操作,还有图的可视化.用户通过网页
来编辑自己的图,服务器用AWS
本来打算用java写,也发现boost graph和algs4里面已经提供大部分我目前需要的
function,后来看到neo4j和arangoDB,目前打算先用现成的工具积累数据,了解系统需求,
不知道license的限制和易用性如何? |
|
c*********t 发帖数: 2921 | 31 我在用Boost library, 主要是用Boost Graph Library.
发现算法都是在头文件里实现的,比如要用dijkstra算法,
#include
就行了。
可是我想对boost里的算法进行一点改动,满足我特定的要求,比如对某个算法特定的
情况下处理稍微不同。
看了一下头文件,里面用了很多的template,好像也没有看到算法在头文件里是怎么实
现的,可能是调用了一些boost特有的函数,总之,即使是简单的算法,也不太从头文件
里读懂。
问问,Boost里面,算法真的是所有的功能都在头文件里实现的吗? 一个算法就是在一
个头文件里了吗?
如果想改动一下算法,该如何下手呢?有什么参考的?
谢谢! |
|
c*********t 发帖数: 2921 | 32 我在用Boost library, 主要是用Boost Graph Library.
发现算法都是在头文件里实现的,比如要用dijkstra算法,
#include
就行了。
可是我想对boost里的算法进行一点改动,满足我特定的要求,比如对某个算法特定的
情况下处理稍微不同。
看了一下头文件,里面用了很多的template,好像也没有看到算法在头文件里是怎么实
现的,可能是调用了一些boost特有的函数,总之,即使是简单的算法,也不太从头文件
里读懂。
问问,Boost里面,算法真的是所有的功能都在头文件里实现的吗? 一个算法就是在一
个头文件里了吗?
如果想改动一下算法,该如何下手呢?有什么参考的?
谢谢! |
|
c*********t 发帖数: 2921 | 33 我在用Boost library, 主要是用Boost Graph Library.
发现算法都是在头文件里实现的,比如要用dijkstra算法,
#include
就行了。
可是我想对boost里的算法进行一点改动,满足我特定的要求,比如对某个算法特定的
情况下处理稍微不同。
看了一下头文件,里面用了很多的template,好像也没有看到算法在头文件里是怎么实
现的,可能是调用了一些boost特有的函数,总之,即使是简单的算法,也不太从头文件
里读懂。
问问,Boost里面,算法真的是所有的功能都在头文件里实现的吗? 一个算法就是在一
个头文件里了吗?
如果想改动一下算法,该如何下手呢?有什么参考的?
谢谢! |
|
d****i 发帖数: 4809 | 34 This one should be in the classical feedback control book. Since the
transfer function of a feedback loop is G/(1+GH) where G is the feed forward
path gain and H is the feedback path gain. In your case, the first graph
shows that the feed forward path gain is A and feedback gain is -beta, so
the TF is A/(1-A*beta). Similarly, in the second graph, the feed forward
gain is -1/beta and the feedback gain is 1/A, so the TF is (-1/beta)/[1+(-1/
beta)*(1/A)]=A/(1-beta*A), which is identical to the firs |
|
o******d 发帖数: 1552 | 35 I am sorry to tell you that there is a small hole in my proof. You have to
express the graph using the Hesse diagram, then the proof can be corrected
otherwise the "transtivity" does not hold. I check out the definition
in Math site and find it uses this definition for comparability graph:
if p<=q or q<=p, then p is connected to q. Actually, you only need one,
say, p<=q then the Hesse diagram is used:
p
|
|
q
If you don't say it clearly, then the proof may fail in this case:
p<=q |
|
h******y 发帖数: 3501 | 36 I need to make a graph for the following function:
9X^2+10XY+4Y^2=1
I wonder if SAS or other software can produce this graph and what the codes
look like?
Thanks a lot for the help! |
|
s*x 发帖数: 3328 | 37 you can change a graph with vertex \leq 3 into a graph with vertex degree =3
by adding dummy vertex in polynomial time. So it doesn't matter whether \
leq 3 or =3.
/*\\ |
|
r*******y 发帖数: 1081 | 38 an other question:
After I graph this ellipse, I want to graph serval points on
this ellipse, for example (1.02, 0.39), (0.95, 0.32), (0.87, 0.27)
using * to denote these points. How can I do this job in mathematica.
In matlab, we can use "hold" to plot on the same figure frame. But
I have no idea in mathematica.
Thanks. |
|
p*******g 发帖数: 92 | 39 现在我有两个star graph, 其每个节点都有不同的属性,请问可以用什么descriptor
去描述这个star graph呢? 因为我想得到他们的similarity。
非常感谢。 |
|
B**e 发帖数: 60 | 40 You mean n(n-1)/2 edges, right, which is the number of edges a complete
graph with n nodes can have. For the genus of a complete graph, please
follow the link below.
http://mathworld.wolfram.com/GraphGenus.html
a |
|
o****i 发帖数: 23 | 41
谢谢你的回复。这里是想把一个基于最短路径距离的graph metric嵌入到riemannian
manifold, graph metric 肯定是满足三角不等式的。
这个问题可以换个问法,与图论无关:is it true that any finite discrete metric
space can be isometrically embedded into a Riemannian manifold? |
|
o****i 发帖数: 23 | 42 谢谢解释。warped product metric我没听说过,这两天找资料研究一下。
考虑三维欧式空间做ambient space一个可能的好处,就是如果需要的话,可以保证被
嵌入的完全图任意两条边不相交。(平面图可以嵌入二维平面保证任两条边不相交,任
意图都可以嵌入三维空间保证任两条边不相交。)
Nash embedding theorem说任意riemannian manifold可以等距嵌入到欧式空间,而一
个graph又不可以等距嵌入到欧式空间,所以一年前我以为这两个结论就决定了graph
metric不可能等距嵌入到riemannian manifold. 最近我意识到这个想法是错的,因为
Nash定理说的是嵌入之前和之后的geodesic距离相等,而不是嵌入之前的geodesic距离
和嵌入之后的欧式空间直线距离相等。 |
|
o****i 发帖数: 23 | 43
谢谢你的回复。这里是想把一个基于最短路径距离的graph metric嵌入到riemannian
manifold, graph metric 肯定是满足三角不等式的。
这个问题可以换个问法,与图论无关:is it true that any finite discrete metric
space can be isometrically embedded into a Riemannian manifold? |
|
o****i 发帖数: 23 | 44 谢谢解释。warped product metric我没听说过,这两天找资料研究一下。
考虑三维欧式空间做ambient space一个可能的好处,就是如果需要的话,可以保证被
嵌入的完全图任意两条边不相交。(平面图可以嵌入二维平面保证任两条边不相交,任
意图都可以嵌入三维空间保证任两条边不相交。)
Nash embedding theorem说任意riemannian manifold可以等距嵌入到欧式空间,而一
个graph又不可以等距嵌入到欧式空间,所以一年前我以为这两个结论就决定了graph
metric不可能等距嵌入到riemannian manifold. 最近我意识到这个想法是错的,因为
Nash定理说的是嵌入之前和之后的geodesic距离相等,而不是嵌入之前的geodesic距离
和嵌入之后的欧式空间直线距离相等。 |
|
d*******2 发帖数: 47 | 45 Hi all
Thanks for reading it. I am working on a sas/graph project for couple days
without any progress. Kind of stressful and wonder if anyone here can give
me some suggestions.I would really appreciate your input!
This is the first time I used sas/graph function.
I had the dataset
_NAME_ _1 _2 _3 _4 maxcount
Gen1 1.11 1.88 1.03 0.628688619 1.88
Gen2 1.17 1.35 2.01 1.190167356 2.01
and codes
PROC GCHART data=WORK.diagram_final;
vBA |
|
|
w*******y 发帖数: 60932 | 47 I saw a promotion on Staples.com that is good over the phone, online or in
store for the TI-84 Plus graphing calculator. If you want to get in on the
price in the title you'd have to do this in store.
The caclulator is on sale for $99.99 and their is a $10 off Easy Rebate that
will be factored in after all the coupons. See the below website:
Link:
http://www.staples.com/Texas-Instruments-TI-84-Plus-Graphing-Calculator/product-nr_566641
So,
TI-84 Plus = $99.99 - 20% Office Supplies coupon (includ |
|
g****5 发帖数: 1639 | 48 不断加点的时候,不是随机的找K个点,而是跟K个距离最小的点相连。
graph |
|
h*****k 发帖数: 5022 | 49 我想要的物品:
Texas Instruments TI-89 Titanium Graphing Calculator
单张面值:
可接受的价格 (required):
110+my label
物品新旧要求:
brand new
邮寄方式要求:
i choose i pay
买卖双方谁承担邮寄损失(required if not code only):
付款方式说明:
paypal or ING
其他补充说明:
广告的有效期:
物品来源:
我的联系方式: |
|
D******r 发帖数: 347 | 50 我想要的物品:
TI-84 Plus Graphing Calculator @ 80
单张面值:
可接受的价格(必须明码标价!):
more than 4 @ 80
物品新旧要求:
brand new
邮寄方式要求:
ML
买卖双方谁承担邮寄损失(Required if not code only):
before you after me
付款方式说明:
boa/paypal mass pay/check/bill pay/rmb
其他补充说明:
广告的有效期:
物品来源:
staples
我的联系方式:
二手交易风险自负!请自行验证是否合法和一手卡!: |
|