我正在尝试根据一些泊松分布实现图网络的随机矩阵 我想尽可能简单地说:创建一个对称矩阵,其中两个节点之间的连接保存为1或0(如果没有连接)。如何根据泊松分布对节点的度数进行分配,因此根据lambda,泊松曲线是不同的,我记得统计数据。 现在让我说我生成泊松随机分布,如下例所示(poissrnd有第一个lambda,然后矩阵大小作为输入):
List<String> loadedList =
engine.findSomething(param); //At this point we can obtain Exception, so this code block we should move to existing try block or create another.. but the problem if we move this to try block below, the WebApplicationException that throws in condition below will be catched in existing try block..
// if not found - return NOT_FOUND.
if (CollectionUtils.isEmpty(loadedList)) {
log.info(errorMessage);
throw new WebApplicationException(Response.status(Status.NOT_FOUND).entity(errorMessage).type("text/plain").build()); //exception from Jersey lib
}
try {
for (String item : loadedList) {
//some business logic
//I know that on controller layer we should avoid business logic but it is not my code and I can not change it..
}
return Response.ok().build();
} catch (Exception e) {
throw processException(e); //Helper method that avoids code duplication when preparing webException
}
这意味着我有一个节点有6个连接,一个有四个,三个有三个,依此类推。我现在如何根据此分布连接?更重要的是:如何在给定多个顶点V?
的情况下限制边E的数量
例如:我有100个节点,最多有200个边但是泊松分布?
如果有人有一些想法,我将非常感激!
答案 0 :(得分:0)
你不能对泊松分布施加限制,称之为泊松!所以我对这部分的建议是回到你的问题,看看你是否可以重新定义它。看看二项分布。
如果你可以重新定义问题,最好得到一个定义,让你知道两个节点之间连接的可能性,这将使你的生活更轻松。
我希望这会有所帮助。