Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Christnowx
Gephi
提交
5b69bfb8
G
Gephi
项目概览
Christnowx
/
Gephi
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gephi
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5b69bfb8
编写于
5月 13, 2017
作者:
E
Eduardo Ramos
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #1709 Make sure all layouts + timeline work fine with dynamic weights
上级
54d581a9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
9 deletion
+38
-9
modules/LayoutPlugin/src/main/java/org/gephi/layout/plugin/forceAtlas/ForceAtlasLayout.java
.../org/gephi/layout/plugin/forceAtlas/ForceAtlasLayout.java
+16
-4
modules/LayoutPlugin/src/main/java/org/gephi/layout/plugin/forceAtlas2/ForceAtlas2.java
...java/org/gephi/layout/plugin/forceAtlas2/ForceAtlas2.java
+15
-3
modules/LayoutPlugin/src/main/java/org/gephi/layout/plugin/openord/OpenOrdLayout.java
...n/java/org/gephi/layout/plugin/openord/OpenOrdLayout.java
+6
-1
modules/LayoutPlugin/src/main/nbm/manifest.mf
modules/LayoutPlugin/src/main/nbm/manifest.mf
+1
-1
未找到文件。
modules/LayoutPlugin/src/main/java/org/gephi/layout/plugin/forceAtlas/ForceAtlasLayout.java
浏览文件 @
5b69bfb8
...
...
@@ -54,6 +54,7 @@ import org.openide.util.NbBundle;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.gephi.graph.api.Interval
;
import
org.openide.util.Exceptions
;
/**
...
...
@@ -102,10 +103,21 @@ public class ForceAtlasLayout extends AbstractLayout implements Layout {
public
void
initAlgo
()
{
}
private
double
getEdgeWeight
(
Edge
edge
,
boolean
isDynamicWeight
,
Interval
interval
)
{
if
(
isDynamicWeight
)
{
return
edge
.
getWeight
(
interval
);
}
else
{
return
edge
.
getWeight
();
}
}
@Override
public
void
goAlgo
()
{
this
.
graph
=
graphModel
.
getGraphVisible
();
graph
.
readLock
();
boolean
isDynamicWeight
=
graphModel
.
getEdgeTable
().
getColumn
(
"weight"
).
isDynamic
();
Interval
interval
=
graph
.
getView
().
getTimeInterval
();
try
{
Node
[]
nodes
=
graph
.
getNodes
().
toArray
();
Edge
[]
edges
=
graph
.
getEdges
().
toArray
();
...
...
@@ -148,7 +160,7 @@ public class ForceAtlasLayout extends AbstractLayout implements Layout {
Node
nf
=
e
.
getSource
();
Node
nt
=
e
.
getTarget
();
double
bonus
=
(
nf
.
isFixed
()
||
nt
.
isFixed
())
?
(
100
)
:
(
1
);
bonus
*=
e
.
getWeight
(
);
bonus
*=
getEdgeWeight
(
e
,
isDynamicWeight
,
interval
);
ForceVectorUtils
.
fcBiAttractor_noCollide
(
nf
,
nt
,
bonus
*
getAttractionStrength
()
/
(
1
+
graph
.
getDegree
(
nf
)));
}
}
else
{
...
...
@@ -156,7 +168,7 @@ public class ForceAtlasLayout extends AbstractLayout implements Layout {
Node
nf
=
e
.
getSource
();
Node
nt
=
e
.
getTarget
();
double
bonus
=
(
nf
.
isFixed
()
||
nt
.
isFixed
())
?
(
100
)
:
(
1
);
bonus
*=
e
.
getWeight
(
);
bonus
*=
getEdgeWeight
(
e
,
isDynamicWeight
,
interval
);
ForceVectorUtils
.
fcBiAttractor_noCollide
(
nf
,
nt
,
bonus
*
getAttractionStrength
());
}
}
...
...
@@ -166,7 +178,7 @@ public class ForceAtlasLayout extends AbstractLayout implements Layout {
Node
nf
=
e
.
getSource
();
Node
nt
=
e
.
getTarget
();
double
bonus
=
(
nf
.
isFixed
()
||
nt
.
isFixed
())
?
(
100
)
:
(
1
);
bonus
*=
e
.
getWeight
(
);
bonus
*=
getEdgeWeight
(
e
,
isDynamicWeight
,
interval
);
ForceVectorUtils
.
fcBiAttractor
(
nf
,
nt
,
bonus
*
getAttractionStrength
()
/
(
1
+
graph
.
getDegree
(
nf
)));
}
}
else
{
...
...
@@ -174,7 +186,7 @@ public class ForceAtlasLayout extends AbstractLayout implements Layout {
Node
nf
=
e
.
getSource
();
Node
nt
=
e
.
getTarget
();
double
bonus
=
(
nf
.
isFixed
()
||
nt
.
isFixed
())
?
(
100
)
:
(
1
);
bonus
*=
e
.
getWeight
(
);
bonus
*=
getEdgeWeight
(
e
,
isDynamicWeight
,
interval
);
ForceVectorUtils
.
fcBiAttractor
(
nf
,
nt
,
bonus
*
getAttractionStrength
());
}
}
...
...
modules/LayoutPlugin/src/main/java/org/gephi/layout/plugin/forceAtlas2/ForceAtlas2.java
浏览文件 @
5b69bfb8
...
...
@@ -57,6 +57,7 @@ import java.util.List;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Future
;
import
org.gephi.graph.api.Interval
;
import
org.openide.util.Exceptions
;
/**
...
...
@@ -123,6 +124,15 @@ public class ForceAtlas2 implements Layout {
graph
.
readUnlockAll
();
}
}
private
double
getEdgeWeight
(
Edge
edge
,
boolean
isDynamicWeight
,
Interval
interval
)
{
if
(
isDynamicWeight
)
{
return
edge
.
getWeight
(
interval
);
}
else
{
return
edge
.
getWeight
();
}
}
@Override
public
void
goAlgo
()
{
...
...
@@ -131,8 +141,10 @@ public class ForceAtlas2 implements Layout {
return
;
}
graph
=
graphModel
.
getGraphVisible
();
graph
.
readLock
();
boolean
isDynamicWeight
=
graphModel
.
getEdgeTable
().
getColumn
(
"weight"
).
isDynamic
();
Interval
interval
=
graph
.
getView
().
getTimeInterval
();
try
{
Node
[]
nodes
=
graph
.
getNodes
().
toArray
();
Edge
[]
edges
=
graph
.
getEdges
().
toArray
();
...
...
@@ -196,11 +208,11 @@ public class ForceAtlas2 implements Layout {
}
}
else
if
(
getEdgeWeightInfluence
()
==
1
)
{
for
(
Edge
e
:
edges
)
{
Attraction
.
apply
(
e
.
getSource
(),
e
.
getTarget
(),
e
.
getWeight
(
));
Attraction
.
apply
(
e
.
getSource
(),
e
.
getTarget
(),
getEdgeWeight
(
e
,
isDynamicWeight
,
interval
));
}
}
else
{
for
(
Edge
e
:
edges
)
{
Attraction
.
apply
(
e
.
getSource
(),
e
.
getTarget
(),
Math
.
pow
(
e
.
getWeight
(
),
getEdgeWeightInfluence
()));
Attraction
.
apply
(
e
.
getSource
(),
e
.
getTarget
(),
Math
.
pow
(
getEdgeWeight
(
e
,
isDynamicWeight
,
interval
),
getEdgeWeightInfluence
()));
}
}
...
...
modules/LayoutPlugin/src/main/java/org/gephi/layout/plugin/openord/OpenOrdLayout.java
浏览文件 @
5b69bfb8
...
...
@@ -52,6 +52,8 @@ import java.util.concurrent.CyclicBarrier;
import
org.gephi.graph.api.Edge
;
import
org.gephi.graph.api.Graph
;
import
org.gephi.graph.api.GraphModel
;
import
org.gephi.graph.api.GraphView
;
import
org.gephi.graph.api.Interval
;
import
org.gephi.layout.spi.Layout
;
import
org.gephi.layout.spi.LayoutBuilder
;
import
org.gephi.layout.spi.LayoutProperty
;
...
...
@@ -113,6 +115,9 @@ public class OpenOrdLayout implements Layout, LongTask {
//Get graph
graph
=
graphModel
.
getUndirectedGraphVisible
();
graph
.
readLock
();
boolean
isDynamicWeight
=
graphModel
.
getEdgeTable
().
getColumn
(
"weight"
).
isDynamic
();
Interval
interval
=
graph
.
getView
().
getTimeInterval
();
try
{
int
numNodes
=
graph
.
getNodeCount
();
...
...
@@ -145,7 +150,7 @@ public class OpenOrdLayout implements Layout, LongTask {
int
source
=
idMap
.
get
(
e
.
getSource
().
getStoreId
());
int
target
=
idMap
.
get
(
e
.
getTarget
().
getStoreId
());
if
(
source
!=
target
)
{
//No self-loop
float
weight
=
(
float
)
e
.
getWeight
(
);
float
weight
=
(
float
)
(
isDynamicWeight
?
e
.
getWeight
(
interval
)
:
e
.
getWeight
()
);
if
(
neighbors
[
source
]
==
null
)
{
neighbors
[
source
]
=
new
TIntFloatHashMap
(
hashingStrategy
);
}
...
...
modules/LayoutPlugin/src/main/nbm/manifest.mf
浏览文件 @
5b69bfb8
Manifest-Version: 1.0
AutoUpdate-Essential-Module: true
OpenIDE-Module-Localizing-Bundle: org/gephi/layout/plugin/Bundle.properties
OpenIDE-Module-Specification-Version: 0.9.1.
1
OpenIDE-Module-Specification-Version: 0.9.1.
2
OpenIDE-Module-Display-Category: Plugin
OpenIDE-Module-Name: Layout Plugin
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录