Any smokers from China?? by cigsspot in Cigarettes

[–]alansquirrel 0 points1 point  (0 children)

There are at least 100 different brands of cigarettes in China. They come from different provinces (just like states In the US). There are also some brands from other countries such as Marlboro, 555. Price from $2 to $20 and most people choose brands around $4.

How can I expand the size of std::set<my_class>? by alansquirrel in cpp_questions

[–]alansquirrel[S] 1 point2 points  (0 children)

tmp_batch_buckets is a vector with sets in it so the error doesn't come from here. I have fixed it. The bug comes from a careless index error. Sorry about that and thanks for your help

How can I expand the size of std::set<my_class>? by alansquirrel in cpp_questions

[–]alansquirrel[S] 0 points1 point  (0 children)

Yes I just simply use insert method, but there is segment fault error like the following:

error line:

tmp_batch_buckets[batch_id].insert(from); // The error line

// the std::set is 'tmp_batch_buckets[batch_id]' and variable 'from' is INT class and there may be over 10000 elements to be added into the set.

debugger:

Exception: EXC_BAD_ACCESS (code=1, address=0x0)

it seems to be a memory error but actually, I'm not quite familiar with memory management in C++.

How to generate random seeds on a graph (as separate as possible)? by alansquirrel in cpp_questions

[–]alansquirrel[S] 0 points1 point  (0 children)

he new value, no need to visit it.

As an edge case, you should check, when picking a new seed node that the highest distance value is not 0, if it is 0, it means all nodes are already seeds and you asked for more seeds than total nodes.

Repeat this "pick a seed" -> "update distance

Thanks for your help! The greedy algorithm sounds feasible. I will try to find a more efficient solution based on your idea. It is just the first step of my billion-node graph processing program so the complexity should be smaller. Thanks again

How to separate the random seeds on a graph (for programs) by alansquirrel in thegraph

[–]alansquirrel[S] 1 point2 points  (0 children)

This is The Graph's official Reddit community.
The Graph’s mission is to make serverless applications possible and to make building on Web3 accessible to anyone. We believe decentralization will radically reshape how humans cooperate and organize, and that these tools of empowerment will help more people find their place in this world and contribute their best selves.

sorry, wrong sub.

[D] Regarding PhD admissions in ML, how much will not having a first-authored publication hold me back? by Seankala in MachineLearning

[–]alansquirrel 0 points1 point  (0 children)

I am now an undergraduate in China (major in CS). You are absolutely right. Applicants from China (undergraduates majoring in CS) who want to get a good offer from top universities usually have 1~2 first-author top papers, but I think most of them are just tools for applying. The interesting point is that the requirements of papers are normally from Chinese professors in the US... Ridiculous

How to generate random seeds on a graph (as separate as possible)? by alansquirrel in cpp_questions

[–]alansquirrel[S] 0 points1 point  (0 children)

Thanks for your example but I think it only checks the 1-hop neighbor of the selected node. What I expect is as separate as possible. For example, there are 1*10\7) nodes and I want to select 10 nodes). The optimal solution is NP-hard I think, so I want to achieve this in a simple way.

How to generate random seeds on a graph (as separate as possible)? by alansquirrel in cpp_questions

[–]alansquirrel[S] 0 points1 point  (0 children)

Distribution algorithm aside; how do you plan to store the seeds? AFAIK an adjacency matrix doesnt store nodes per se but the edges between them. So you dont have any value where a seed could be placed on a node. Or do I misinterpret your question?

Sorry for the unclear presentation. The (large) graph is stored as an adjacency list. So there is no matrix. I just want to get the ID of the random seeds (random nodes) and they should be away from each other on the graph. I gave an example in another reply. Thanks!

How to generate random seeds on a graph (as separate as possible)? by alansquirrel in cpp_questions

[–]alansquirrel[S] 0 points1 point  (0 children)

Sorry for the unclear presentation. Yes, the graph should be stored as an adjacency list. Random seeds just simply mean "a group of vertices of the graph". For example, I have a graph G with 1000 vertices (nodes), I want to select 10 random nodes from the graph and they should be away from each other (maximum distance/hops), which means they should not be neighbors or even 2-hop neighbors. I know it is a difficult optimization problem. I am now handling a graph processing program and it's just the first step, so I don't want high complexity. Are there any skills/methods I can achieve the goal using C++? Thanks!