Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
TinySTL
提交
a99ae600
T
TinySTL
项目概览
OpenDocCN
/
TinySTL
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TinySTL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a99ae600
编写于
2月 09, 2015
作者:
邹
邹晓航
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
完成adjacent_nodes
上级
abc076fa
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
4 deletion
+20
-4
TinySTL/Detail/Graph.impl.h
TinySTL/Detail/Graph.impl.h
+16
-1
TinySTL/Graph.h
TinySTL/Graph.h
+4
-3
未找到文件。
TinySTL/Detail/Graph.impl.h
浏览文件 @
a99ae600
...
...
@@ -42,12 +42,27 @@ namespace TinySTL{
if
(
equal_func
(
pair
.
first
.
first
,
index
))
return
bucket_iterator
(
this
,
(
pair
.
second
).
end
());
}
throw
std
::
exception
(
"return end error"
);
//throw std::exception("return end error");
return
bucket_iterator
();
}
template
<
class
Index
,
class
Value
,
class
EqualFunc
>
size_t
graph
<
Index
,
Value
,
EqualFunc
>::
size
()
const
{
return
size_
;
}
template
<
class
Index
,
class
Value
,
class
EqualFunc
>
typename
graph
<
Index
,
Value
,
EqualFunc
>::
node_sets
graph
<
Index
,
Value
,
EqualFunc
>::
adjacent_nodes
(
const
Index
&
index
){
node_sets
s
;
for
(
auto
it
=
begin
(
index
);
it
!=
end
(
index
);
++
it
){
s
.
push_back
(
*
it
);
}
return
s
;
}
template
<
class
Index
,
class
Value
,
class
EqualFunc
>
typename
graph
<
Index
,
Value
,
EqualFunc
>::
node_sets
graph
<
Index
,
Value
,
EqualFunc
>::
adjacent_nodes
(
const
node
&
n
){
return
adjacent_nodes
(
n
.
first
);
}
//********************************************************************************
template
<
class
Index
,
class
Value
,
class
EqualFunc
>
graph_iterator
<
Index
,
Value
,
EqualFunc
>&
graph_iterator
<
Index
,
Value
,
EqualFunc
>::
operator
++
(){
...
...
TinySTL/Graph.h
浏览文件 @
a99ae600
...
...
@@ -30,14 +30,15 @@ namespace TinySTL{
virtual
~
graph
(){};
virtual
void
add_node
(
const
node
&
item
,
const
node_sets
&
nodes
)
=
0
;
//virtual void delte_node(const node& item) = 0;
//virtual node_sets adjacent_nodes(const node& n) = 0;
//virtual node_sets adjacent_nodes(const Index& index) = 0;
//virtual void DFS(visiter_func_type func) = 0;
//virtual void BFS(visiter_func_type func) = 0;
static
node
&
new_node
(
const
Index
&
index
,
const
Value
&
val
);
bool
is_contained
(
const
Index
&
index
);
inline
static
node_sets
empty_node_set
();
node_sets
adjacent_nodes
(
const
Index
&
index
);
node_sets
adjacent_nodes
(
const
node
&
n
);
inline
bool
empty
()
const
;
inline
size_t
size
()
const
;
inline
bucket_iterator
begin
(
const
Index
&
index
);
...
...
@@ -56,7 +57,7 @@ namespace TinySTL{
typedef
graph
<
Index
,
Value
,
EqualFunc
>
graph_type
;
typedef
typename
list
<
typename
graph_type
::
node
>::
iterator
inner_it_type
;
public:
graph_iterator
(
cntrPtr
c
,
inner_it_type
iit
)
explicit
graph_iterator
(
cntrPtr
c
=
nullptr
,
inner_it_type
iit
=
inner_it_type
()
)
:
container_
(
c
),
inner_it_
(
iit
){}
graph_iterator
&
operator
++
();
const
graph_iterator
operator
++
(
int
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录