91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

異構信息網絡中基于元路徑APVPA的相似度PathSim實現,基于Path2.7

資源截圖

代碼片段和文件信息

#!/usr/bin/env?python
import?os
import?sys
from?StringIO?import?StringIO
from?collections?import?defaultdict
import?operator

????
class?DBLPnetwork_PathSim:
????
????def?__init__(self?author?venue?paper?relation):

????????self.author_dict?=?{}
????????self.venue_dict?=?{}
????????self.paper_dict?=?{}
????????self.relation_dict?=?defaultdict(list)
????????self.author_paper_dict?=?defaultdict(list)
????????self.paper_venue_dict?=?defaultdict(list)
????????self.APV_dict?=?defaultdict(list)
????????self.AV_dict=?{}
????????self.AA_dict_APVPA?=?{}
????????self.AA_dict_APTPA?=?{}
????????self.part1_AA_dict_APVPA?=?{}
????????self.part1_AA_dict_APTPA?=?{}
????????self.part2_AA_dict_APVPA?=?{}
????????self.part2_AA_dict_APTPA?=?{}
????????self._file_to_dict(author?venue?paper?relation)
????????self._build_paths()
????????self._build_APV_path()

????def?_file_to_dict(selfauthor?venue?paper?relation):

????????self._read_relation(relation)
????????self._read_author(author)
????????self._read_venue(venue)
????????self._read_paper(paper)
???????????????
????????
????def?_read_relation(self?relation):

????????with?open(relation)?as?r:
????????????for?line?in?r:
????????????????(key?val?none)?=?line.split()
????????????????self.relation_dict[key].append(val)
????????????????
????????print?“Relation?Length?:?%d“?%?len(self.relation_dict)

????def?_read_author(self?author):

????????with?open(author)?as?a:
????????????for?line?in?a:
????????????????splitLine?=?line.split()
????????????????self.author_dict[splitLine[0]]?=?‘?‘.join(splitLine[1:])

????????print?“Author?Length?:?%d“?%?len(self.author_dict)
??
????def?_read_venue(self?venue):

????????with?open(venue)?as?v:
????????????for?line?in?v:
????????????????splitLine?=?line.split()
????????????????self.venue_dict[splitLine[0]]?=??‘?‘.join(splitLine[1:])
????????print?“Venue?Length?:?%d“?%?len(self.venue_dict)

????def?_read_paper(self?paper):

????????with?open(paper)?as?p:
????????????for?line?in?p:
????????????????splitLine?=?line.split()
????????????????self.paper_dict[splitLine[0]]?=?‘?‘.join(splitLine[1:])
????????print?“Paper?Length?:?%d“?%?len(self.paper_dict)


????def?_build_paths(self):

????????for?paperid?ids?in?self.relation_dict.iteritems():
????????????if?self.paper_dict.has_key(paperid):
????????????????paper?=?self.paper_dict.get(paperid)
????????????else:
????????????????break
??????????????????
????????????for?i?in?ids:
????????????????#?Build?author?paper?path?in?the?author_paper_dict
????????????????if?self.author_dict.has_key(i):
????????????????????author?=?self.author_dict.get(i)
????????????????????self.author_paper_dict[author].append(paper)
????????????????#?Build?paper?venue?path?in?the?venue_paper_dict?
????????????????elif?self.venue_dict.has_key(i):
????????????????????venue?=?self.venue_dict.get(i)
????????????????????self.paper_venue_dict[paper].append(venue)

????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-03-29?11:01??PathSim-table3\
?????文件??????????37??2016-03-23?08:49??PathSim-table3\author.txt
?????文件????????4292??2016-03-23?09:19??PathSim-table3\paper.txt
?????文件????????7715??2016-03-26?17:05??PathSim-table3\pathsim.py
?????文件????????1381??2016-03-23?09:19??PathSim-table3\relation.txt
?????文件??????????46??2016-03-23?08:53??PathSim-table3\venue.txt

評論

共有 條評論